/* ============================================
   VARIABLES Y RESET
   ============================================ */
:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #DBEAFE;
    --success: #16A34A;
    --success-light: #DCFCE7;
    --danger: #DC2626;
    --danger-light: #FEE2E2;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --gray: #6B7280;
    --gray-light: #F3F4F6;
    --gray-lighter: #E5E7EB;
    --white: #FFFFFF;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 240px;
    --header-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F8FAFC;
    color: #0F172A;
    display: flex;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ============================================
   LOGIN
   ============================================ */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    overflow: hidden;
}

.login-header {
    padding: 30px 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--gray-lighter);
}

.login-header .logo h1 {
    font-size: 28px;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: -1px;
}

.login-header .logo span {
    font-size: 13px;
    color: var(--gray);
}

.login-tabs {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-top: 16px;
}

.login-tabs a {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray);
    padding-bottom: 8px;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}

.login-tabs a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.login-body {
    padding: 30px;
}

.login-body h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #0F172A;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--gray);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-lighter);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: 0.2s;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.captcha-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.captcha-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 6px;
    background: var(--gray-light);
    padding: 6px 18px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    color: #0F172A;
}

.captcha-refresh {
    font-size: 18px;
    color: var(--gray);
    padding: 6px 10px;
    border-radius: 6px;
    transition: 0.2s;
}

.captcha-refresh:hover {
    background: var(--gray-light);
    color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #15803D;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #B91C1C;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: #FEE2E2;
    border: 1px solid #FCA5A5;
    color: #991B1B;
}

.alert-success {
    background: #DCFCE7;
    border: 1px solid #86EFAC;
    color: #166534;
}

.login-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
}

.login-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--gray-lighter);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 50;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--gray-lighter);
}

.sidebar-logo h2 {
    font-size: 22px;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-logo span {
    font-size: 11px;
    color: var(--gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-selector {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-lighter);
}

.sidebar-selector label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray);
    display: block;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.sidebar-selector select {
    width: 100%;
    padding: 6px 10px;
    border: 1.5px solid var(--gray-lighter);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    background: var(--white);
}

.sidebar-selector select:focus {
    outline: none;
    border-color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 20px;
    margin: 2px 10px;
    font-size: 14px;
    font-weight: 500;
    color: #4B5563;
    border-radius: var(--radius-sm);
    transition: 0.15s;
}

.sidebar-nav ul li a:hover {
    background: var(--gray-light);
    color: var(--primary);
}

.sidebar-nav ul li a.active {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-nav ul li a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--gray-lighter);
    text-align: center;
}

.sidebar-footer p {
    font-weight: 600;
    font-size: 13px;
    color: #0F172A;
}

.sidebar-footer small {
    display: block;
    color: var(--gray);
    font-size: 11px;
    margin-bottom: 6px;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--danger);
    padding: 4px 14px;
    border-radius: 6px;
    transition: 0.2s;
}

.btn-logout:hover {
    background: #FEE2E2;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-lighter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left .breadcrumb {
    font-size: 14px;
    color: var(--gray);
}

.header-left .breadcrumb span {
    color: #0F172A;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-right .user-info .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.header-right .user-info .user-name {
    font-size: 14px;
    font-weight: 500;
}

.header-right .user-info .user-rol {
    font-size: 12px;
    color: var(--gray);
}

/* ============================================
   CONTENT
   ============================================ */
.content {
    padding: 24px 32px 40px;
    flex: 1;
}

.dashboard-header {
    margin-bottom: 28px;
}

.dashboard-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: #0F172A;
}

.dashboard-header p {
    color: var(--gray);
    font-size: 15px;
    margin-top: 2px;
}

/* ============================================
   MODULOS GRID - ESTILO CORRECTO
   ============================================ */
.modulos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.modulo-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}

.modulo-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--gray-lighter);
}

.modulo-card .modulo-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.modulo-card .modulo-info h3 {
    font-size: 13px;
    font-weight: 600;
    color: #0F172A;
    line-height: 1.3;
}

.modulo-card .modulo-info p {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
}

.modulo-card.admin-card .modulo-icon {
    background: var(--danger-light);
    color: var(--danger);
}

/* ============================================
   MODULE VIEWS
   ============================================ */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.module-header h1 {
    font-size: 22px;
    font-weight: 700;
}

.module-header p {
    color: var(--gray);
    font-size: 14px;
}

.module-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box form {
    display: flex;
    align-items: center;
    background: var(--white);
    border: 1.5px solid var(--gray-lighter);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: 0.2s;
}

.search-box form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.search-box input {
    padding: 8px 14px;
    border: none;
    font-size: 14px;
    min-width: 240px;
    font-family: inherit;
    background: transparent;
}

.search-box input:focus {
    outline: none;
}

.search-box button {
    padding: 8px 14px;
    color: var(--gray);
    font-size: 16px;
}

.search-box button:hover {
    color: var(--primary);
}

.search-box .btn-clear {
    padding: 8px 12px;
    color: var(--gray);
    font-size: 14px;
}

.search-box .btn-clear:hover {
    color: var(--danger);
}

/* ============================================
   TABLA - CON ALINEACIÓN CORREGIDA
   ============================================ */
.table-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}

.table thead {
    background: #F8FAFC;
}

.table thead th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--gray);
    border-bottom: 2px solid var(--gray-lighter);
    white-space: nowrap;
    vertical-align: middle;
    height: 48px;
}

.table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-lighter);
    vertical-align: middle;
    line-height: 1.4;
    height: 52px;
}

.table tbody tr {
    cursor: pointer;
    transition: 0.1s;
}

.table tbody tr:hover {
    background: #F8FAFC;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Columna de acciones - alineación correcta */
.table th:first-child,
.table td:first-child {
    width: 130px;
    min-width: 130px;
    max-width: 130px;
    padding: 10px;
    vertical-align: middle !important;
    text-align: center;
}

/* La celda de acciones mantiene table-cell */
.table td.actions {
    display: table-cell !important;
    vertical-align: middle !important;
    text-align: center !important;
    line-height: 0;
}

/* Los botones se alinean inline */
.table .actions .btn-adjuntar,
.table .actions .btn-editar,
.table .actions .btn-eliminar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0 1px;
    border-radius: 6px;
    font-size: 13px;
    transition: 0.15s;
    vertical-align: middle;
    line-height: 1;
}

.table .actions .btn-adjuntar {
    color: var(--gray);
}

.table .actions .btn-adjuntar:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.table .actions .btn-editar {
    color: var(--gray);
}

.table .actions .btn-editar:hover {
    color: var(--warning);
    background: var(--warning-light);
}

.table .actions .btn-eliminar {
    color: var(--gray);
}

.table .actions .btn-eliminar:hover {
    color: var(--danger);
    background: var(--danger-light);
}
.text-center {
    text-align: center !important;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    width: 100%;
    max-width: 540px;
    max-height: 100vh;
    overflow-y: auto;
    border-radius: var(--radius) 0 0 var(--radius);
    box-shadow: -4px 0 40px rgba(0,0,0,0.08);
}

.modal-content.modal-side {
    max-width: 580px;
    border-radius: var(--radius) 0 0 var(--radius);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    border-bottom: 1px solid var(--gray-lighter);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 28px;
    color: var(--gray);
    padding: 0 4px;
    transition: 0.2s;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px 28px;
}

/* ============================================
   DETALLE MODAL
   ============================================ */
.detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    margin-bottom: 20px;
}

.detalle-grid .detalle-item {
    display: flex;
    flex-direction: column;
}

.detalle-grid .detalle-item .label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray);
    letter-spacing: 0.3px;
}

.detalle-grid .detalle-item .value {
    font-size: 14px;
    font-weight: 500;
    padding-top: 2px;
    color: #0F172A;
}

.detalle-grid .detalle-item.full {
    grid-column: span 2;
}

.observaciones-section {
    margin-top: 20px;
    border-top: 1px solid var(--gray-lighter);
    padding-top: 16px;
}

.observaciones-section h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #0F172A;
}

.observacion-item {
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 6px;
}

.observacion-item .obs-text {
    font-size: 14px;
}

.observacion-item .obs-meta {
    font-size: 11px;
    color: var(--gray);
    margin-top: 4px;
}

.observacion-input {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.observacion-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--gray-lighter);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
}

.observacion-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.archivos-section {
    margin-top: 20px;
    border-top: 1px solid var(--gray-lighter);
    padding-top: 16px;
}

.archivos-section h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #0F172A;
}

.archivo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.archivo-item .archivo-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.archivo-item .archivo-info i {
    font-size: 18px;
    color: var(--primary);
}

.archivo-item .archivo-info .nombre {
    font-size: 13px;
    font-weight: 500;
}

.archivo-item .archivo-info .meta {
    font-size: 11px;
    color: var(--gray);
}

.archivo-item .archivo-actions {
    display: flex;
    gap: 4px;
}

.archivo-item .archivo-actions button {
    padding: 2px 8px;
    font-size: 14px;
    border-radius: 4px;
    transition: 0.15s;
}

.archivo-item .archivo-actions .btn-download {
    color: var(--primary);
}

.archivo-item .archivo-actions .btn-download:hover {
    background: var(--primary-light);
}

.archivo-item .archivo-actions .btn-eliminar-archivo {
    color: var(--danger);
}

.archivo-item .archivo-actions .btn-eliminar-archivo:hover {
    background: var(--danger-light);
}

/* ============================================
   USERS MANAGEMENT
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card .stat-number {
    font-size: 26px;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--gray);
    font-weight: 500;
}

.stat-card.primary .stat-number { color: var(--primary); }
.stat-card.success .stat-number { color: var(--success); }
.stat-card.danger .stat-number { color: var(--danger); }
.stat-card.warning .stat-number { color: var(--warning); }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-secondary {
    background: var(--gray-light);
    color: var(--gray);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .header {
        padding: 0 16px;
    }
    
    .content {
        padding: 16px;
    }
    
    .modulos-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .search-box input {
        min-width: 140px;
    }
    
    .module-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .module-actions {
        flex-wrap: wrap;
    }
    
    .detalle-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        max-width: 100%;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    
    .header-right .user-info .user-name {
        display: none;
    }
}

/* ============================================
   MODAL DETALLE - CENTRADO Y MEJORADO
   ============================================ */

/* Contenedor principal del modal */
.modal-content {
    background: var(--white);
    width: 100%;
    max-width: 620px;
    max-height: 100vh;
    overflow-y: auto;
    border-radius: var(--radius) 0 0 var(--radius);
    box-shadow: -4px 0 40px rgba(0,0,0,0.08);
}

/* Para que el modal se vea centrado en pantallas pequeñas */
@media (max-width: 768px) {
    .modal {
        justify-content: center !important;
        align-items: center !important;
    }
    .modal-content {
        max-width: 95% !important;
        border-radius: var(--radius) !important;
        max-height: 90vh !important;
    }
}

/* Estilos para el detalle - mejor alineación */
.detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    margin-bottom: 20px;
    padding: 4px 0;
}

.detalle-grid .detalle-item {
    display: flex;
    flex-direction: column;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-lighter);
}

.detalle-grid .detalle-item .label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray);
    letter-spacing: 0.5px;
    margin-bottom: 1px;
}

.detalle-grid .detalle-item .value {
    font-size: 15px;
    font-weight: 500;
    color: #0F172A;
    padding-top: 1px;
}

.detalle-grid .detalle-item.full {
    grid-column: span 2;
}

/* Observaciones - centrado y mejorado */
.observaciones-section {
    margin-top: 20px;
    border-top: 2px solid var(--gray-lighter);
    padding-top: 16px;
}

.observaciones-section h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 8px;
}

.observaciones-section h4::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

.observacion-item {
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 8px;
}

.observacion-item .obs-text {
    font-size: 14px;
    color: #0F172A;
}

.observacion-item .obs-meta {
    font-size: 11px;
    color: var(--gray);
    margin-top: 4px;
    font-weight: 500;
}

/* Input de observación - centrado */
.observacion-input {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    width: 100%;
}

.observacion-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-lighter);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: 0.2s;
    background: var(--white);
}

.observacion-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.observacion-input .btn {
    padding: 10px 18px;
    flex-shrink: 0;
}

/* Archivos adjuntos - centrado y mejorado */
.archivos-section {
    margin-top: 20px;
    border-top: 2px solid var(--gray-lighter);
    padding-top: 16px;
}

.archivos-section h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 8px;
}

.archivos-section h4::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 16px;
    background: var(--success);
    border-radius: 2px;
}

.archivo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: 0.15s;
}

.archivo-item:hover {
    background: #EEF2FF;
}

.archivo-item .archivo-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.archivo-item .archivo-info i {
    font-size: 20px;
    color: var(--primary);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.archivo-item .archivo-info .nombre {
    font-size: 13px;
    font-weight: 500;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.archivo-item .archivo-info .meta {
    font-size: 11px;
    color: var(--gray);
    flex-shrink: 0;
}

.archivo-item .archivo-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.archivo-item .archivo-actions button,
.archivo-item .archivo-actions a {
    padding: 4px 10px;
    font-size: 14px;
    border-radius: 6px;
    transition: 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archivo-item .archivo-actions .btn-download {
    color: var(--primary);
}

.archivo-item .archivo-actions .btn-download:hover {
    background: var(--primary-light);
}

.archivo-item .archivo-actions .btn-eliminar-archivo {
    color: var(--danger);
}

.archivo-item .archivo-actions .btn-eliminar-archivo:hover {
    background: var(--danger-light);
}

/* Botón de subir archivo - centrado */
.archivos-section .btn-upload-wrapper {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.archivos-section .btn-upload-wrapper .btn {
    padding: 10px 24px;
    font-size: 13px;
    gap: 8px;
}

/* Botones de acción del modal */
.modal-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    border-top: 2px solid var(--gray-lighter);
    padding-top: 20px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal-actions .btn {
    padding: 10px 24px;
    font-size: 14px;
}

/* Mensaje de vacío */
.empty-message {
    color: var(--gray);
    font-size: 14px;
    text-align: center;
    padding: 8px 0;
    font-style: italic;
}

/* Responsive */
@media (max-width: 600px) {
    .detalle-grid {
        grid-template-columns: 1fr;
        gap: 6px 0;
    }
    
    .detalle-grid .detalle-item.full {
        grid-column: span 1;
    }
    
    .archivo-item {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .archivo-item .archivo-info {
        width: 100%;
    }
    
    .archivo-item .archivo-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .observacion-input {
        flex-direction: column;
    }
    
    .observacion-input .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   MODAL - CENTRADO EN TODAS LAS PANTALLAS
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-lighter);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #0F172A;
}

.modal-close {
    font-size: 28px;
    color: var(--gray);
    padding: 0 4px;
    transition: 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

/* Responsive - centrado en móviles */
@media (max-width: 640px) {
    .modal-content {
        max-width: 95%;
        max-height: 95vh;
        margin: 10px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-header {
        padding: 14px 16px;
    }
    
    .modal-header h2 {
        font-size: 16px;
    }
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.paginacion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-lighter);
    flex-wrap: wrap;
    gap: 12px;
    background: var(--white);
    border-radius: 0 0 var(--radius) var(--radius);
}

.paginacion-info {
    font-size: 13px;
    color: var(--gray);
    font-weight: 500;
}

.paginacion-info strong {
    color: #0F172A;
    font-weight: 600;
}

.paginacion-controles {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.paginacion-controles a,
.paginacion-controles span {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    color: #4B5563;
    background: var(--white);
    border: 1px solid var(--gray-lighter);
    transition: 0.15s;
    text-decoration: none;
    line-height: 1;
}

.paginacion-controles a:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.paginacion-controles .active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    font-weight: 600;
}

.paginacion-controles .disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.paginacion-controles .puntos {
    border: none;
    background: transparent;
    color: var(--gray);
    min-width: 24px;
    padding: 0;
}

.paginacion-controles i {
    font-size: 12px;
}

@media (max-width: 768px) {
    .paginacion {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .paginacion-controles {
        justify-content: center;
    }
}