/* ============================================================
   ====================== PSI UPTAMCA =========================
   ==================== ESTILOS GLOBALES ======================
   ============================================================
   📅 Versión: 5.0 (unificada)
   🎨 Paleta: Azul UPTAMCA + Colores profesionales
   📱 Mobile First con mejoras para PC y zoom
   ✅ Incluye estilos específicos del dashboard
   ============================================================ */

/* ============================================================
   🔥 VARIABLES Y RESET
   ============================================================ */

:root {
    --color-primary: #003366;
    --color-primary-dark: #002244;
    --color-primary-light: #1a4d7a;
    --color-secondary: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #0d6efd;
    --color-gray: #6c757d;
    --color-light: #f8f9fa;
    --color-white: #ffffff;
    --color-dark: #212529;
    --color-text: #333333;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    --sidebar-width: 280px;
    --max-width: 90%;
    --max-width-dashboard: 90%;
    --max-width-form: 90%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    max-width: 100%;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: #f0f2f5;
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 1rem;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img, table, iframe {
    max-width: 100%;
    height: auto;
}

/* ============================================================
   🔥 CONTENEDORES
   ============================================================ */

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.container-small {
    width: 100%;
    max-width: var(--max-width-form);
    margin: 0 auto;
    padding: 0 16px;
}

.container-large {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

.dashboard-wrapper {
    width: 100%;
    max-width: var(--max-width-dashboard);
    margin: 0 auto;
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   🔥 UTILIDADES GENERALES
   ============================================================ */

.text-center { text-align: center; }
.text-muted { color: var(--color-gray); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.w-100 { width: 100%; }

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

/* ============================================================
   🔥 LOGIN, REGISTRO Y RECUPERACIÓN
   ============================================================ */

.login-body,
.register-body,
.forgot-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #003366 0%, #1a4d7a 100%);
    padding: 20px;
}

.login-container,
.register-container,
.forgot-container {
    width: 100%;
    max-width: 90%;
    margin: 0 auto;
}

.login-card,
.register-card,
.forgot-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: var(--shadow-xl);
    animation: fadeIn 0.5s ease;
    max-width: 90%;
    margin: 0 auto;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-area {
    text-align: center;
    margin-bottom: 20px;
}

.institutional-logo {
    max-width: 140px;
    height: auto;
    margin-bottom: 8px;
}

.login-card h2,
.register-card h2,
.forgot-card h2 {
    text-align: center;
    font-size: 1.1rem;
    color: var(--color-primary);
    margin-bottom: 20px;
    font-weight: 600;
    line-height: 1.4;
}

/* ============================================================
   🔥 FORMULARIOS
   ============================================================ */

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--color-dark);
    font-size: 0.9rem;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ced4da;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background: var(--color-white);
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    min-height: 48px;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.15);
}

.input-group input:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

.input-group input::placeholder {
    color: #adb5bd;
    font-size: 0.95rem;
}

.input-group small {
    display: block;
    margin-top: 4px;
    color: var(--color-gray);
    font-size: 0.8rem;
}

/* Ejemplos y ayudas externas: permanecen visibles mientras se escribe. */
.field-example {
    display: block;
    width: 100%;
    margin-top: 4px;
    color: var(--color-gray);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.35;
}

.input-group .error {
    color: var(--color-danger);
    font-size: 0.8rem;
}

.password-group {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--color-gray);
    font-size: 1.2rem;
    padding: 8px;
    z-index: 5;
    touch-action: manipulation;
}

.toggle-password:hover {
    color: var(--color-dark);
}

/* ============================================================
   🔥 CHECKBOX PERSONALIZADO
   ============================================================ */

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 16px;
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.9rem;
    color: var(--color-dark);
    cursor: pointer;
    margin-bottom: 0;
    user-select: none;
    -webkit-user-select: none;
}

.custom-checkbox {
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    background: var(--color-white);
    border: 2px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin: 0;
    padding: 0;
    min-height: 20px;
    min-width: 20px;
}

.custom-checkbox:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.custom-checkbox:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-white);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.custom-checkbox:hover {
    border-color: var(--color-primary);
}

.custom-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.15);
}

.custom-checkbox:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   🔥 BOTONES
   ============================================================ */

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    width: 100%;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--color-light);
    color: var(--color-dark);
    border: 1px solid #dee2e6;
    padding: 12px 20px;
    border-radius: var(--radius-xl);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    min-height: 48px;
    touch-action: manipulation;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.btn-cancel {
    background: transparent;
    color: var(--color-gray);
    border: 1px solid #dee2e6;
    padding: 12px 20px;
    border-radius: var(--radius-xl);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    min-height: 48px;
    touch-action: manipulation;
}

.btn-cancel:hover {
    background: #f1f3f5;
    border-color: #ced4da;
}

/* ============================================================
   🔥 BOTONES DE ACCIÓN EN TABLAS — COMPACTOS Y ORDENADOS
   ============================================================ */

.acciones-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    align-items: center;
    justify-content: flex-start;
}

.btn-aprobar,
.btn-rechazar,
.btn-editar,
.btn-icon,
.btn-detalle,
.btn-doc,
.btn-asignar {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    touch-action: manipulation;
    transition: all 0.15s;
    color: white !important;
    background: #6c757d;
    text-decoration: none;
    line-height: 1;
    flex-shrink: 0;
}

.btn-aprobar { background: #28a745; }
.btn-aprobar:hover { background: #218838; transform: scale(1.05); }

.btn-rechazar { background: #dc3545; }
.btn-rechazar:hover { background: #c82333; transform: scale(1.05); }

.btn-editar { background: #ffc107; color: #212529 !important; }
.btn-editar:hover { background: #e0a800; transform: scale(1.05); }

.btn-detalle { background: #0d6efd; }
.btn-detalle:hover { background: #0b5ed7; transform: scale(1.05); }

.btn-icon { background: #6c757d; }
.btn-icon:hover { background: #5a6268; transform: scale(1.05); }

.btn-doc.btn-subir-doc { background: #0d6efd; }
.btn-doc.btn-visualizar { background: #0d6efd; }
.btn-doc.btn-descargar { background: #28a745; }
.btn-doc.btn-reemplazar-doc { background: #ffc107; color: #212529 !important; }
.btn-doc.btn-eliminar-doc { background: #dc3545; }

.btn-doc:hover { transform: scale(1.05); filter: brightness(1.1); }

.btn-asignar { background: #6c757d; }
.btn-asignar:hover { background: #5a6268; transform: scale(1.05); }

.btn-aprobar i,
.btn-rechazar i,
.btn-editar i,
.btn-icon i,
.btn-detalle i,
.btn-doc i,
.btn-asignar i {
    font-size: 0.75rem;
    pointer-events: none;
}

/* ============================================================
   🔥 ENLACES DE FORMULARIO
   ============================================================ */

.login-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    text-align: center;
}

.login-links a {
    color: var(--color-primary);
    font-size: 0.9rem;
    transition: color var(--transition-fast);
    touch-action: manipulation;
    padding: 4px 0;
}

.login-links a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* ============================================================
   🔥 MENSAJES
   ============================================================ */

.message-area {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: none;
    font-size: 0.95rem;
}

.message-area.success {
    display: block;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message-area.error {
    display: block;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.message-area.info {
    display: block;
    background: #e0f2fe;
    color: #0c4e6e;
    border: 1px solid #bae6fd;
}

/* ============================================================
   🔥 LAYOUT PRINCIPAL
   ============================================================ */

.dashboard-body {
    background: #f0f2f5;
}

.app-layout {
    display: flex;
    flex: 1;
    min-height: 100vh;
    width: 100%;
}

/* ============================================================
   🔥 SIDEBAR
   ============================================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: var(--sidebar-width);
    height: 100%;
    background: var(--color-primary);
    color: var(--color-white);
    z-index: 1000;
    overflow-y: auto;
    transition: left var(--transition-normal);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
    padding: 16px 0;
}

.sidebar.open {
    left: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    pointer-events: auto;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-overlay:not(.active) {
    display: none !important;
    pointer-events: none !important;
}

.sidebar-logo {
    text-align: center;
    padding: 0 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo img {
    max-width: 120px;
    height: auto;
    margin-bottom: 6px;
    filter: brightness(1.2);
}

.sidebar-logo h3 {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.8;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    padding: 12px 10px;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.75);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 2px;
    cursor: pointer;
    touch-action: manipulation;
    min-height: 48px;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-item i {
    width: 22px;
    font-size: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
    border-left-color: var(--color-warning);
}

.sidebar-nav .nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-white);
    font-weight: 500;
    border-left-color: var(--color-warning);
}

/* ============================================================
   🔥 MAIN CONTENT
   ============================================================ */

.main-content {
    flex: 1;
    padding: 12px 14px 30px;
    margin-left: 0;
    width: 100%;
    min-height: 100vh;
}

/* ============================================================
   🔥 TOP BAR
   ============================================================ */

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 14px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 16px;
    gap: 10px;
}

.menu-icon {
    display: block;
    font-size: 1.6rem;
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    touch-action: manipulation;
    min-height: 48px;
    min-width: 48px;
}

.menu-icon:hover {
    background: rgba(0, 51, 102, 0.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--color-dark);
    flex: 1;
    justify-content: flex-end;
}

.user-info i {
    font-size: 1.5rem;
    color: var(--color-primary);
}

/* ============================================================
   🔥 SECCIONES (dashboard)
   ============================================================ */

.seccion-contenido {
    display: none;
    animation: fadeIn 0.3s ease;
}

.seccion-contenido[style*="display:block"] {
    display: block;
}

/* ============================================================
   🔥 TARJETAS DE ESTADÍSTICAS
   ============================================================ */

.stats-card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    border-left: 4px solid var(--color-primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stats-card i {
    font-size: 1.6rem;
    color: var(--color-primary);
    background: rgba(0, 51, 102, 0.08);
    padding: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.stats-card h3 {
    font-size: 0.85rem;
    color: var(--color-gray);
    margin: 0;
    font-weight: 500;
}

.stats-card p {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-dark);
    margin: 2px 0 0 0;
}

.stats-card strong {
    color: var(--color-primary);
    font-size: 1.1rem;
}

/* ============================================================
   🔥 CONTADORES DE ESTADO
   ============================================================ */

.estado-counters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.estado-counter {
    background: white;
    padding: 16px 20px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.estado-counter:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.estado-counter .emoji {
    font-size: 2rem;
    display: block;
    margin-bottom: 4px;
}

.estado-counter .count {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 4px 0 0;
}

.estado-counter .label {
    font-size: 0.8rem;
    color: #666;
    margin: 0;
}

.estado-counter.aprobado .count { color: #28a745; }
.estado-counter.rechazado .count { color: #dc3545; }
.estado-counter.pendiente .count { color: #e6a800; }

/* ============================================================
   🔥 BARRA DE HERRAMIENTAS
   ============================================================ */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.toolbar .search-wrapper {
    flex: 1;
    min-width: 160px;
    max-width: 500px;
}

.toolbar .search-wrapper input {
    width: 100%;
    padding: 10px 18px;
    border-radius: 40px;
    border: 1px solid #ddd;
    font-size: 0.95rem;
    transition: border 0.2s, box-shadow 0.2s;
}

.toolbar .search-wrapper input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,51,102,0.1);
}

.toolbar .filtro-wrapper {
    min-width: 140px;
}

.toolbar .filtro-wrapper select {
    width: 100%;
    padding: 10px 18px;
    border-radius: 40px;
    border: 1px solid #ddd;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

.toolbar .filtro-wrapper select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,51,102,0.1);
}

.toolbar .btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-toolbar {
    padding: 10px 18px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    touch-action: manipulation;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-toolbar:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-toolbar.pdf {
    background: #28a745;
    color: white;
}
.btn-toolbar.pdf:hover {
    background: #218838;
}

.btn-toolbar.excel {
    background: #0d6efd;
    color: white;
}
.btn-toolbar.excel:hover {
    background: #0b5ed7;
}

.btn-toolbar.refresh {
    background: var(--color-primary);
    color: white;
}
.btn-toolbar.refresh:hover {
    background: var(--color-primary-dark);
}

/* ============================================================
   🔥 TABLA — FLUIDA Y ADAPTABLE AL ZOOM
   ============================================================ */

.table-container {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 12px 12px 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 16px;
}

.table-container h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1rem;
    color: var(--color-dark);
    padding: 0 4px;
}

.table-container h3 i {
    color: var(--color-primary);
    margin-right: 6px;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}

.table-container table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.table-container thead {
    background: var(--color-light);
}

.table-container th {
    color: var(--color-dark);
    font-weight: 600;
    text-align: left;
    padding: 8px 6px;
    border-bottom: 2px solid #e9ecef;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.table-container td {
    padding: 8px 6px;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
}

.table-container tbody tr:hover {
    background: #f8f9fa;
}

/* 🔥 ANCHOS PROPORCIONALES DE COLUMNAS (15 columnas) */

.table-container th:nth-child(1),
.table-container td:nth-child(1) { width: 14%; }  /* Nombre */

.table-container th:nth-child(2),
.table-container td:nth-child(2) { width: 8%; }   /* Tipo */

.table-container th:nth-child(3),
.table-container td:nth-child(3) { width: 7%; }   /* Tutor */

.table-container th:nth-child(4),
.table-container td:nth-child(4) { width: 6%; }   /* Trayecto */

.table-container th:nth-child(5),
.table-container td:nth-child(5) { width: 7%; }   /* Comunidad */

.table-container th:nth-child(6),
.table-container td:nth-child(6) { width: 5%; }   /* Eje */

.table-container th:nth-child(7),
.table-container td:nth-child(7) { width: 8%; }   /* Coordenadas */

.table-container th:nth-child(8),
.table-container td:nth-child(8) { width: 8%; }   /* N° Estudiante */

.table-container th:nth-child(9),
.table-container td:nth-child(9) { width: 8%; }   /* N° Encargado */

.table-container th:nth-child(10),
.table-container td:nth-child(10) { width: 5%; }  /* Comuna Piloto */

.table-container th:nth-child(11),
.table-container td:nth-child(11) { width: 7%; }  /* Profesor */

.table-container th:nth-child(12),
.table-container td:nth-child(12) { width: 5%; }  /* Fecha */

.table-container th:nth-child(13),
.table-container td:nth-child(13) { width: 6%; }  /* Estado */

.table-container th:nth-child(14),
.table-container td:nth-child(14) { width: 3%; }  /* Documento */

.table-container th:nth-child(15),
.table-container td:nth-child(15) { width: 3%; }  /* Acciones */

/* Estados en la tabla */
.estado-aprobado {
    color: var(--color-secondary);
    font-weight: 600;
}

.estado-rechazado {
    color: var(--color-danger);
    font-weight: 600;
}

.estado-pendiente {
    color: #e6a800;
    font-weight: 600;
}

.estado-completado {
    color: var(--color-primary);
    font-weight: 600;
}

/* Documentos */
.documento-existente { color: #28a745; font-weight: 500; }
.documento-ausente { color: #6c757d; }

/* ============================================================
   🔥 MODALES
   ============================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: flex-start;
    padding: 20px 12px;
    overflow-y: auto;
    animation: fadeInModal 0.3s ease;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    max-width: 90%;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    animation: slideInModal 0.3s ease;
    margin: auto 0;
}

.modal-large {
    max-width: 800px;
}

@keyframes slideInModal {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--color-primary);
    font-size: 1.15rem;
    padding-right: 36px;
}

.modal-content .close-modal {
    position: absolute;
    top: 14px;
    right: 16px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--color-gray);
    transition: color var(--transition-fast), transform var(--transition-fast);
    background: none;
    border: none;
    line-height: 1;
    padding: 4px 8px;
    touch-action: manipulation;
}

.modal-content .close-modal:hover {
    color: var(--color-dark);
    transform: rotate(90deg);
}

.modal-content .form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.modal-content .form-actions .btn-primary,
.modal-content .form-actions .btn-cancel {
    width: 100%;
}

/* ============================================================
   🔥 DETALLE DEL PROYECTO (MODAL)
   ============================================================ */

.detalle-proyecto h3 {
    color: var(--color-primary);
    margin-bottom: 16px;
    font-size: 1.2rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.detalle-proyecto h4 {
    color: var(--color-primary);
    margin: 20px 0 10px;
    font-size: 1rem;
}

.detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    margin: 16px 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.detalle-grid div {
    padding: 4px 0;
    font-size: 0.9rem;
}

.detalle-grid strong {
    color: var(--color-primary);
}

.detalle-integrantes {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.detalle-integrantes li {
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

/* ============================================================
   🔥 FORMULARIOS DE REGISTRO DE PROYECTO Y COMUNIDADES
   ============================================================ */

.form-container {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 16px 14px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.form-container h2 {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--color-primary);
    font-size: 1.1rem;
}

.form-container h2 i {
    margin-right: 6px;
}

.form-container h3 {
    margin-top: 0;
    margin-bottom: 14px;
    color: var(--color-primary);
    font-size: 1rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
}

.form-row .input-group {
    width: 100%;
}

/* ============================================================
   🔥 INTEGRANTES
   ============================================================ */

.integrantes-section {
    margin: 16px 0;
    padding: 14px;
    background: var(--color-light);
    border-radius: var(--radius-md);
    border: 1px solid #e9ecef;
}

.integrantes-section label {
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.integrante-card {
    background: var(--color-white);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
}

.integrante-card .form-row {
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.integrante-card .form-row .input-group {
    flex: 1;
    min-width: 0;
}

.integrante-card .btn-eliminar {
    background: none;
    border: none;
    color: var(--color-danger);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px 10px;
    touch-action: manipulation;
    min-height: 44px;
    min-width: 44px;
}

.integrante-card .btn-eliminar:hover {
    transform: scale(1.1);
}

.integrante-card .btn-eliminar:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================================
   🔥 RESPONSIVE: TABLETS (≥ 768px)
   ============================================================ */

@media (min-width: 768px) {
    body {
        font-size: 1rem;
    }

    .login-card,
    .register-card,
    .forgot-card {
        padding: 32px 28px;
        max-width: 90%;
    }

    .login-card h2,
    .register-card h2,
    .forgot-card h2 {
        font-size: 1.2rem;
    }

    .main-content {
        padding: 20px 24px 40px;
    }

    .top-bar {
        padding: 12px 0 20px;
    }

    .user-info {
        font-size: 0.95rem;
    }

    .stats-card {
        padding: 20px 24px;
        gap: 20px;
    }

    .stats-card i {
        font-size: 2.2rem;
        padding: 16px;
    }

    .stats-card h3 {
        font-size: 0.95rem;
    }

    .stats-card p {
        font-size: 1.3rem;
    }

    .table-container {
        padding: 20px 24px;
    }

    .table-container table {
        font-size: 0.85rem;
    }

    .table-container th,
    .table-container td {
        padding: 12px 14px;
    }

    .form-container {
        padding: 24px 28px;
        max-width: 90%;
    }

    .form-row {
        flex-direction: row;
        gap: 20px;
    }

    .form-row .input-group {
        flex: 1;
        min-width: 200px;
    }

    .modal-content {
        padding: 28px 32px;
        max-width: 90%;
        margin: auto;
    }

    .modal-content .form-actions {
        flex-direction: row;
    }

    .modal-content .form-actions .btn-primary,
    .modal-content .form-actions .btn-cancel {
        width: auto;
        flex: 1;
    }

    .btn-primary,
    .btn-secondary,
    .btn-cancel {
        width: auto;
        padding: 12px 28px;
        min-height: 48px;
    }

    .custom-checkbox {
        width: 18px;
        height: 18px;
        min-height: 18px;
        min-width: 18px;
    }

    .custom-checkbox:checked::after {
        font-size: 13px;
    }
}

/* ============================================================
   🔥 RESPONSIVE: PC (≥ 1024px)
   ============================================================ */

@media (min-width: 1024px) {
    .app-layout {
        flex-direction: row;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: var(--sidebar-width);
        height: 100%;
        transform: none;
        z-index: 100;
        padding: 20px 0;
        max-width: var(--sidebar-width);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: var(--sidebar-width);
        padding: 24px 24px 40px;
        min-height: 100vh;
        max-width: calc(100% - var(--sidebar-width));
        width: calc(100% - var(--sidebar-width));
    }

    .menu-icon {
        display: none;
    }

    .top-bar {
        padding: 16px 0 24px;
    }

    .table-container table {
        font-size: 0.85rem;
    }

    .btn-primary,
    .btn-secondary,
    .btn-cancel {
        padding: 12px 32px;
        min-height: 48px;
        width: auto;
        min-width: 140px;
    }

    /* 🔥 LOGO DEL SIDEBAR MÁS GRANDE EN PC (SIN AFECTAR LOGIN) */
    .sidebar-logo {
        padding: 24px 20px 20px;
    }

    .sidebar-logo img {
        max-width: 180px !important;
        max-height: 80px;
        width: 100%;
        height: auto;
        margin-bottom: 12px;
    }

    .sidebar-logo h3 {
        font-size: 1.3rem !important;
        font-weight: 600;
        letter-spacing: 1.5px;
    }
}

/* ============================================================
   🔥 RESPONSIVE: PANTALLAS MEDIANAS (1024px - 1200px)
   ============================================================ */

@media (min-width: 1024px) and (max-width: 1200px) {
    .main-content {
        padding: 24px 16px 40px;
    }

    .table-container {
        padding: 16px 16px;
    }

    .stats-card {
        padding: 16px 18px;
    }
}

/* ============================================================
   🔥 RESPONSIVE: PC GRANDE (≥ 1400px)
   ============================================================ */

@media (min-width: 1400px) {
    .main-content {
        padding: 30px 40px 50px;
        max-width: calc(100% - var(--sidebar-width));
    }

    .table-container table {
        font-size: 0.85rem;
    }

    .table-container th,
    .table-container td {
        padding: 10px 10px;
    }

    .sidebar-logo img {
        max-width: 200px !important;
        max-height: 90px;
    }

    .sidebar-logo h3 {
        font-size: 1.4rem !important;
    }
}

/* ============================================================
   🔥 RESPONSIVE: PANTALLAS MUY GRANDES (≥ 1920px)
   ============================================================ */

@media (min-width: 1920px) {
    .main-content {
        padding: 30px 60px 60px;
        max-width: calc(100% - var(--sidebar-width));
    }

    .table-container th,
    .table-container td {
        font-size: 0.9rem;
        padding: 12px 12px;
    }

    .table-container table {
        font-size: 0.9rem;
    }
}

/* ============================================================
   🔥 RESPONSIVE: MÓVIL (≤ 768px)
   ============================================================ */

@media (max-width: 768px) {
    .login-card,
    .register-card,
    .forgot-card {
        padding: 24px 18px;
        max-width: 95%;
    }

    .login-card h2,
    .register-card h2,
    .forgot-card h2 {
        font-size: 1.1rem;
    }

    .top-bar {
        padding: 8px 0 16px;
    }

    .user-info span {
        font-size: 0.85rem;
    }

    .stats-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 16px 20px;
    }

    .stats-card i {
        font-size: 1.8rem;
        padding: 12px;
    }

    .form-row {
        flex-direction: column;
        gap: 4px;
    }

    .form-row .input-group {
        min-width: 100%;
    }

    .form-container {
        padding: 16px;
        max-width: 95%;
    }

    .modal-content {
        padding: 20px 16px;
        max-width: 95%;
        max-height: 95vh;
    }

    .modal-content .form-actions {
        flex-direction: column;
    }

    .modal-content .form-actions .btn-primary,
    .modal-content .form-actions .btn-cancel {
        width: 100%;
    }

    /* 🔥 TABLA EN MÓVIL: SCROLL HORIZONTAL */
    .table-container {
        padding: 12px 0;
    }

    .table-container h3 {
        padding: 0 16px;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-container table {
        font-size: 0.7rem;
        min-width: 800px;
        table-layout: auto;
    }

    .table-container th,
    .table-container td {
        padding: 6px 8px;
        font-size: 0.7rem;
    }

    /* Restaurar el ancho automático en móvil */
    .table-container th:nth-child(n),
    .table-container td:nth-child(n) {
        width: auto;
    }

    .btn-primary,
    .btn-secondary,
    .btn-cancel {
        padding: 12px 18px;
        font-size: 0.9rem;
        min-height: 44px;
        width: 100%;
    }

    .btn-aprobar,
    .btn-rechazar,
    .btn-editar,
    .btn-icon,
    .btn-detalle,
    .btn-doc,
    .btn-asignar {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }

    .institutional-logo {
        max-width: 140px;
    }

    .integrante-card .form-row {
        flex-direction: row;
    }

    .login-links a {
        font-size: 0.85rem;
    }

    .custom-checkbox {
        width: 22px;
        height: 22px;
        min-height: 22px;
        min-width: 22px;
    }

    .custom-checkbox:checked::after {
        font-size: 16px;
    }

    .checkbox-group label {
        font-size: 0.95rem;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    .toolbar .search-wrapper {
        max-width: 100%;
        flex: 1 1 100%;
    }

    .toolbar .filtro-wrapper {
        width: 100%;
        min-width: unset;
    }

    .toolbar .btn-group {
        justify-content: center;
        flex-wrap: wrap;
    }

    .btn-toolbar {
        padding: 8px 16px;
        font-size: 0.8rem;
        min-height: 38px;
    }

    /* 🔥 MODAL DETALLE EN MÓVIL */
    .detalle-grid {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 12px;
        font-size: 0.85rem;
    }
}

/* ============================================================
   🔥 TELÉFONOS PEQUEÑOS (≤ 480px)
   ============================================================ */

@media (max-width: 480px) {
    .main-content {
        padding: 10px;
    }

    .login-card,
    .register-card,
    .forgot-card {
        padding: 20px 14px;
        max-width: 98%;
    }

    .login-card h2,
    .register-card h2,
    .forgot-card h2 {
        font-size: 1rem;
    }

    .stats-card {
        padding: 14px 16px;
    }

    .stats-card h3 {
        font-size: 0.85rem;
    }

    .stats-card p {
        font-size: 1.1rem;
    }

    .modal-content {
        padding: 16px 12px;
        max-width: 98%;
    }

    .modal-content h2 {
        font-size: 1.1rem;
    }

    .table-container {
        padding: 8px 4px;
    }

    .table-container table {
        font-size: 0.65rem;
        min-width: 700px;
    }

    .table-container th,
    .table-container td {
        padding: 4px 6px;
    }

    .form-container {
        padding: 12px;
        max-width: 98%;
    }

    .input-group input,
    .input-group select {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .btn-primary,
    .btn-secondary,
    .btn-cancel {
        padding: 10px 14px;
        font-size: 0.85rem;
        min-height: 40px;
    }

    .btn-toolbar {
        padding: 6px 12px;
        font-size: 0.75rem;
        min-height: 34px;
    }

    .estado-counters {
        gap: 8px;
    }

    .estado-counter {
        padding: 10px 8px;
    }

    .estado-counter .emoji {
        font-size: 1.4rem;
    }

    .estado-counter .count {
        font-size: 1.1rem;
    }

    .estado-counter .label {
        font-size: 0.7rem;
    }

    .btn-aprobar,
    .btn-rechazar,
    .btn-editar,
    .btn-icon,
    .btn-detalle,
    .btn-doc,
    .btn-asignar {
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
    }
}

/* ============================================================
   🔥 SCROLLBAR PERSONALIZADA (solo en escritorio)
   ============================================================ */

@media (min-width: 992px) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    ::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    ::-webkit-scrollbar-thumb {
        background: #c1c7cd;
        border-radius: 4px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: #a0a7ad;
    }

    .sidebar::-webkit-scrollbar {
        width: 4px;
    }
    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.3);
        border-radius: 4px;
    }
}

/* ============================================================
   🔥 BOTÓN DE LOGIN CENTRADO Y DESTACADO
   ============================================================ */

.login-card .btn-primary,
.register-card .btn-primary,
.forgot-card .btn-primary {
    width: 80%;
    max-width: 280px;
    display: block;
    margin: 0 auto;
    font-size: 1.1rem;
    padding: 14px 20px;
    border-radius: 50px;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.login-card .btn-primary:hover,
.register-card .btn-primary:hover,
.forgot-card .btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 51, 102, 0.3);
}

@media (max-width: 480px) {
    .login-card .btn-primary,
    .register-card .btn-primary,
    .forgot-card .btn-primary {
        width: 95%;
        max-width: 100%;
        font-size: 1rem;
        padding: 14px 16px;
    }
}

@media (min-width: 768px) {
    .login-card .btn-primary,
    .register-card .btn-primary,
    .forgot-card .btn-primary {
        width: 70%;
        max-width: 320px;
        font-size: 1.15rem;
        padding: 16px 28px;
    }
}

@media (min-width: 1200px) {
    .login-card .btn-primary,
    .register-card .btn-primary,
    .forgot-card .btn-primary {
        width: 60%;
        max-width: 360px;
        font-size: 1.2rem;
        padding: 18px 32px;
    }
}

/* Seguridad del perfil y filtros administrativos */
.profile-security-card {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid #e3e8ef;
    border-radius: 14px;
    background: #f8fafc;
}
.profile-security-card h3 {
    margin: 0 0 8px;
    color: #003366;
    display: flex;
    align-items: center;
    gap: 9px;
}
.profile-security-card p {
    color: #5b6573;
    line-height: 1.5;
    margin: 6px 0 14px;
}
.profile-security-card .btn-primary { margin-top: 8px; }
.admin-status-filter {
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 40px;
    background: #fff;
    color: #333;
    font-size: .9rem;
    max-width: 100%;
}
.estado-cuenta {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}
.estado-activo { background: #dcfce7; color: #166534; }
.estado-desactivado { background: #fef3c7; color: #92400e; }
.estado-eliminado { background: #fee2e2; color: #991b1b; }
@media (max-width: 640px) {
    .profile-security-card { padding: 14px; }
    .admin-status-filter { width: 100%; }
}




/* Ayudas permanentes y medidor local de fortaleza de contraseña */
.input-group small.field-hint { color: var(--color-gray); }
.password-strength { margin-top: 7px; }
.password-strength-track {
    width: 100%; height: 6px; overflow: hidden; border-radius: 999px;
    background: #e5e7eb;
}
.password-strength-bar {
    width: 0; height: 100%; border-radius: inherit;
    background: #dc2626; transition: width .18s ease, background-color .18s ease;
}
.password-strength-bar[data-level="media"] { background: #d97706; }
.password-strength-bar[data-level="fuerte"] { background: #16a34a; }
.password-strength-label { display: block; margin-top: 5px; font-weight: 600; }
