:root {
    --uas-blue: #003366;
    --uas-gold: #d4af37;
    --bg-gray: #f4f7f6;
    --text-dark: #212529;
    --border-color: #dee2e6;
    --hover-bg: #eef2f7;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg-gray); margin: 0; color: var(--text-dark); }

/* Login Overlay (Mantenido) */
.login-overlay { position: fixed; inset: 0; background: var(--uas-blue); display: flex; justify-content: center; align-items: center; z-index: 2000; }
.login-card { background: white; padding: 3rem; border-radius: 12px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.3); max-width: 400px; width: 90%; }

/* Header */
header { background: var(--uas-blue); color: white; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 4px solid var(--uas-gold); }

/* Contenedor Principal */
.dashboard-container { padding: 20px; max-width: 1400px; margin: 0 auto; }

/* Barra de Herramientas (Filtros y Buscador) */
.toolbar { display: flex; flex-direction: column; gap: 8px; background: white; padding: 15px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.toolbar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.toolbar-context { padding-top: 8px; border-top: 1px solid #eef0f2; }
.toolbar-context select { font-size: 0.82rem; padding: 7px 8px; }
.filter-group-label { font-size: 0.75rem; font-weight: 700; color: #999; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.4px; }
.toolbar input, .toolbar select { padding: 10px; border: 1px solid var(--border-color); border-radius: 4px; font-size: 0.9rem; }
.toolbar .search-box { flex-grow: 1; min-width: 220px; }
.btn-bulk-delete { background: #c0392b; color: white; border: none; padding: 10px 18px; border-radius: 4px; cursor: pointer; font-weight: bold; white-space: nowrap; }
.btn-bulk-delete:disabled { background: #ccc; cursor: not-allowed; }
.btn-bulk-delete:not(:disabled):hover { background: #a93226; }
.btn-bulk-message { background: var(--uas-blue); color: white; border: none; padding: 10px 18px; border-radius: 4px; cursor: pointer; font-weight: bold; white-space: nowrap; }
.btn-bulk-message:disabled { background: #ccc; cursor: not-allowed; }
.btn-bulk-message:not(:disabled):hover { background: #004080; }
.btn-bulk-whatsapp { background: #25d366; color: white; border: none; padding: 10px 18px; border-radius: 4px; cursor: pointer; font-weight: bold; white-space: nowrap; }
.btn-bulk-whatsapp:disabled { background: #ccc; cursor: not-allowed; }
.btn-bulk-whatsapp:not(:disabled):hover { background: #1da851; }
.btn-export { background: #1a7a4a; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: bold; white-space: nowrap; }
.btn-export:hover { background: #155d38; }
.btn-add { background: #003366; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: bold; white-space: nowrap; }
.btn-add:hover { background: #004080; }

/* Tabla de Datos */
.table-container { background: white; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); overflow: auto; max-height: 65vh; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { background: var(--uas-blue); color: white; padding: 12px 15px; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.data-table td { padding: 12px 15px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.data-table tr:hover { background-color: var(--hover-bg); }
.name-link { color: var(--uas-blue); font-weight: bold; text-decoration: none; cursor: pointer; }
.name-link:hover { text-decoration: underline; color: var(--uas-gold); }

/* Badges de estado */
.badge { padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: bold; white-space: nowrap; display: inline-block; }
.badge-ia-valido      { background: #d4edda; color: #155724; }
.badge-ia-pendiente   { background: #fff3cd; color: #856404; }
.badge-bounced        { background: #f8d7da; color: #721c24; }
.badge-intervention   { background: #fff3cd; color: #7d4c00; border: 1px solid #f0c040; }
.badge-aprobado       { background: #d4edda; color: #155724; border: 1px solid #88c98a; }
.badge-aprobado small { font-weight: normal; opacity: 0.75; font-size: 0.68rem; margin-left: 3px; }
.badge-ai-completed   { background: #d4edda; color: #155724; border: 1px solid #88c98a; }
.badge-validado-manual{ background: #d4edda; color: #155724; border: 1px solid #88c98a; }
.badge-pending-warning{ background: #fdecea; color: #8c1d18; border: 1px solid #f28b82; }
.badge-sent           { background: #e8f0fe; color: #1a47a0; border: 1px solid #aac4f0; }

/* Etiquetas de contexto del estudiante */
.context-tag {
    display: inline-block;
    background: #eef0f2;
    color: #3a3f47;
    border: 1px solid #d0d5db;
    border-radius: 10px;
    font-size: 0.72rem;
    padding: 2px 8px;
    margin: 2px 2px 2px 0;
    white-space: nowrap;
}


.tab-btn { padding: 15px 20px; border: none; background: none; cursor: pointer; font-weight: bold; color: #666; border-bottom: 3px solid transparent; } .tab-btn.active { color: #003366; border-bottom: 3px solid #d4af37; }

/* Modal (Ventana de Detalles) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; width: 90%; max-width: 1000px; max-height: 90vh; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.modal-crm { max-width: 1100px; }
.modal-header { background: var(--uas-blue); color: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 4px solid var(--uas-gold); gap: 12px; flex-wrap: wrap; }
.modal-header-info { flex: 1; min-width: 0; }
.modal-header-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.modal-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.modal-close { background: transparent; color: white; border: none; font-size: 1.5rem; cursor: pointer; }
.modal-body { padding: 20px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.modal-col-left { display: flex; flex-direction: column; gap: 14px; }
.modal-col-right { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }

/* Botones de acción en cabecera del modal */
.btn-modal-action { padding: 7px 13px; border-radius: 4px; border: none; cursor: pointer; font-size: 0.82rem; font-weight: bold; white-space: nowrap; }
.btn-modal-msg { background: rgba(255,255,255,0.18); color: white; border: 1px solid rgba(255,255,255,0.45); }
.btn-modal-msg:hover { background: rgba(255,255,255,0.3); }
.btn-modal-del { background: #c0392b; color: white; }
.btn-modal-del:hover { background: #a93226; }

/* Tarjetas CRM */
.crm-card { background: #f9fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px; }
.crm-card-title { margin: 0 0 12px 0; font-size: 0.92rem; color: var(--uas-blue); font-weight: 700; }
.crm-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.crm-field { display: flex; flex-direction: column; margin-bottom: 10px; }
.crm-field:last-child { margin-bottom: 0; }
.crm-label { font-size: 0.7rem; text-transform: uppercase; color: #999; font-weight: 700; letter-spacing: 0.4px; margin-bottom: 2px; }
.crm-value { font-size: 0.92rem; color: #333; word-break: break-all; }
.crm-email-row { display: flex; align-items: center; gap: 6px; }
.crm-input { width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.88rem; font-family: inherit; }
.btn-icon { background: transparent; border: none; cursor: pointer; font-size: 0.95rem; padding: 2px 4px; opacity: 0.55; line-height: 1; }
.btn-icon:hover { opacity: 1; }
.btn-sm { padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 0.82rem; font-weight: bold; border: 1px solid #ccc; background: white; font-family: inherit; }
.btn-sm.btn-primary { background: var(--uas-blue); color: white; border-color: var(--uas-blue); }
.btn-outline-blue { padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; font-weight: bold; background: transparent; border: 1px solid var(--uas-blue); color: var(--uas-blue); font-family: inherit; }
.btn-outline-blue:hover { background: var(--uas-blue); color: white; }

/* Miembros de red de apoyo */
.support-member { padding: 8px 0; border-bottom: 1px solid #edf0f4; font-size: 0.85rem; }
.support-member:last-child { border-bottom: none; }
.support-role { display: inline-block; font-size: 0.68rem; text-transform: uppercase; color: #fff; background: var(--uas-blue); border-radius: 8px; padding: 1px 7px; margin-bottom: 3px; font-weight: 700; }
.support-name { display: block; color: #333; font-weight: 600; }
.support-email { display: block; color: #777; font-size: 0.82rem; }

/* Media Box en Modal */
.media-box { background: #000; border-radius: 8px; display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 200px; }
.media-box img, .media-box video { max-width: 100%; max-height: 350px; border-radius: 8px 8px 0 0; }

@media (max-width: 768px) {
    .modal-body { grid-template-columns: 1fr; }
    .toolbar input, .toolbar select { width: 100%; box-sizing: border-box; }
    .modal-header-actions { width: 100%; justify-content: flex-end; }
}

/* Paginación */
.pagination-container { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 14px 0 4px; }
.btn-page { background: var(--uas-blue); color: white; border: none; padding: 8px 20px; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 0.88rem; }
.btn-page:hover:not(:disabled) { background: #004080; }
.btn-page:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination-info { font-size: 0.88rem; color: #555; white-space: nowrap; }

.hidden { display: none !important; }
.btn-primary { background: var(--uas-blue); color: white; border: none; padding: 12px 25px; border-radius: 4px; cursor: pointer; font-weight: bold; }
.btn-outline { background: transparent; color: white; border: 1px solid white; padding: 5px 15px; cursor: pointer; border-radius: 4px; }