/* SOSQR - Global Premium Style System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    /* Color Palette */
    --primary: #005a9c;
    --primary-dark: #003f6d;
    --secondary: #6c757d;
    --danger: #ff3e3e;
    --danger-dark: #cc0000;
    --success: #28a745;
    --warning: #ffc107;
    --info: #17a2b8;

    /* Neutral Colors */
    --bg-main: #f4f7f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --text-main: #2d3436;
    --text-muted: #636e72;
    --border-color: rgba(223, 230, 233, 0.5);

    /* Effects */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
    background: radial-gradient(circle at 10% 20%, rgba(0, 90, 156, 0.05) 0%, rgba(244, 247, 249, 1) 90.2%);
}

/* Premium Components */

/* Cards */
.premium-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
}

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

/* Buttons */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    gap: 8px;
    font-size: 1rem;
}

.btn-premium-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 90, 156, 0.3);
}

.btn-premium-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 90, 156, 0.4);
    transform: scale(1.02);
}

.btn-premium-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(255, 62, 62, 0.3);
}

.btn-premium-danger:hover {
    box-shadow: 0 6px 20px rgba(255, 62, 62, 0.4);
    transform: scale(1.02);
}

.btn-premium-secondary {
    background: rgba(108, 117, 125, 0.08);
    color: var(--text-main);
    border: 1px solid rgba(108, 117, 125, 0.2);
    box-shadow: none;
}

.btn-premium-secondary:hover {
    background: rgba(108, 117, 125, 0.15);
    color: var(--text-main);
    border-color: rgba(108, 117, 125, 0.4);
    transform: scale(1.02);
}

/* Form Inputs */
.premium-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    transition: var(--transition);
    font-size: 1rem;
}

.premium-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 90, 156, 0.1);
}

/* Headers */
.branding-bar {
    background: white;
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1001;
}

.branding-left {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.branding-bar img {
    max-height: 45px;
    display: block;
}

/* Brand Navigation Menu */
.brand-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.brand-nav-item {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

.brand-nav-item:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Dropdown Logic */
.brand-dropdown {
    position: relative;
}

.brand-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 0.5rem 0;
    z-index: 1002;
    border: 1px solid var(--glass-border);
    margin-top: 0.5rem;
    animation: slideDown 0.2s ease-out;
}

/* Robust bridge to prevent menu from closing when moving mouse from toggle to content */
/* Uses a pseudo-element that extends UPWARDS to cover the margin-top gap */
.brand-dropdown-content::before {
    content: '';
    position: absolute;
    top: -20px;
    /* Cubre el hueco del margin-top de sobra */
    left: 0;
    right: 0;
    height: 25px;
    /* Altura suficiente para el puente */
    background: transparent;
    z-index: -1;
}

.brand-dropdown:hover .brand-dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.7rem 1.2rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.dropdown-link:hover {
    background: var(--bg-main);
    color: var(--primary);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.premium-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 1rem 2rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: var(--radius-md);
}

/* Stats Widgets */
.stat-widget {
    text-align: center;
    padding: 1.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Action Buttons - Pill Style */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    gap: 6px;
    text-wrap: nowrap;
}

.btn-action-edit {
    background: rgba(0, 90, 156, 0.1);
    color: var(--primary);
    border-color: rgba(0, 90, 156, 0.2);
}

.btn-action-edit:hover {
    background: var(--primary);
    color: white;
}

.btn-action-token {
    background: rgba(180, 83, 9, 0.1);
    color: #b45309;
    border-color: rgba(180, 83, 9, 0.2);
}

.btn-action-token:hover {
    background: #b45309;
    color: white;
}

.btn-action-manage {
    background: rgba(108, 117, 125, 0.1);
    color: var(--secondary);
    border-color: rgba(108, 117, 125, 0.2);
}

.btn-action-manage:hover {
    background: var(--secondary);
    color: white;
}

.btn-action-delete {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.2);
}

.btn-action-delete:hover {
    background: #dc3545;
    color: white;
}

.btn-action-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
    border-color: rgba(40, 167, 69, 0.2);
}

.btn-action-success:hover {
    background: var(--success);
    color: white;
}

.btn-action-primary {
    background: rgba(0, 90, 156, 0.1);
    color: var(--primary);
    border-color: rgba(0, 90, 156, 0.2);
}

.btn-action-primary:hover {
    background: var(--primary);
    color: white;
}

/* Layout Utilities */
.section-separator {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px dashed var(--border-color);
}

.premium-title {
    position: relative;
    padding-left: 15px;
    margin-bottom: 2rem;
}

.premium-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
}

/* Custom Table Overrides */
.premium-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.premium-table th {
    background: rgba(0, 90, 156, 0.03);
    color: var(--primary);
    padding: 1rem;
    font-weight: 700;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
}

.premium-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.action-cell {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Phone Prefix Styles */
.phone-prefix-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    overflow: hidden;
    transition: var(--transition);
}

.phone-prefix-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 90, 156, 0.1);
}

.prefix-label {
    background: var(--primary);
    padding: 12px 14px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    user-select: none;
}

.phone-prefix-group .premium-input {
    border: none;
    border-radius: 0;
    padding-left: 10px;
}

/* Grade Selection Refinements */
.grade-group {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: var(--transition);
}

.grade-group:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.grade-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.grade-group-header strong {
    color: var(--primary);
    font-size: 0.95rem;
}

.grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.grade-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-main);
    padding: 4px 0;
}

.grade-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.phone-prefix-group .premium-input:focus {
    box-shadow: none;
}

/* Navigation Tabs - Glassmorphism System */
.tab-group {
    display: flex;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.6rem;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    width: fit-content;
    margin-bottom: 2.5rem;
    transition: var(--transition);
    position: sticky;
    top: 1rem;
    z-index: 900;
}

.tab-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 14px;
    white-space: nowrap;
    transition: var(--transition);
}

.tab-button i {
    font-size: 1.1rem;
    opacity: 0.75;
    transition: var(--transition);
}

.tab-button:hover {
    background: rgba(0, 90, 156, 0.05);
    color: var(--primary);
    transform: translateY(-1px);
}

.tab-button.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 90, 156, 0.25);
}

.tab-button.active i {
    opacity: 1;
    transform: scale(1.1);
    color: white !important;
}

/* Modern Status Pills */
.status-badge {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-alerted,
.status-ALERTA {
    background: linear-gradient(135deg, #ff4b2b, #ff416c);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 75, 43, 0.2);
}

.status-resolved,
.status-RESUELTO,
.status-Resuelto {
    background: linear-gradient(135deg, #56ab2f, #a8e063);
    color: white;
    box-shadow: 0 4px 12px rgba(86, 171, 47, 0.2);
}

.status-Nuevo {
    background: linear-gradient(135deg, #2193b0, #6dd5ed);
    color: white;
}

.status-En-Revisión {
    background: linear-gradient(135deg, #f12711, #f5af19);
    color: white;
}

/* Enhanced Premium Table */
.premium-table-container {
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    overflow: auto !important;
    margin-top: 1.5rem;
    max-height: 60vh !important;
    min-height: 250px !important;
}

.premium-table thead th {
    background: #f1f5f9 !important;
    position: sticky;
    top: 0;
    z-index: 10;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--primary-dark);
    border-bottom: 2px solid rgba(0, 90, 156, 0.1);
    box-shadow: inset 0 -2px 0 rgba(0, 90, 156, 0.1);
}

.premium-table tbody tr {
    transition: var(--transition);
}

.premium-table tbody tr:hover {
    background: rgba(0, 90, 156, 0.02);
    transform: scale(1.002);
}

/* Modern Form Sections */
.form-section-card {
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    padding: 2rem;
    border: 1px solid var(--glass-border);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.form-section-title {
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-title i {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Icon-lead inputs */
.premium-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.premium-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-main);
}

/* Dashboard Titles Improvement */
.premium-title h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    background: linear-gradient(45deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Modales Premium (Popup Style) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    /* Backdrop más ligero */
    backdrop-filter: blur(4px);
    /* Blur más suave */
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    overflow: auto;
    padding: 1rem;
}

.modal-content {
    animation: popupIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 450px;
    width: 100%;
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Tipos de Notificación */
.notif-success #notificationIcon {
    color: var(--success) !important;
}

.notif-error #notificationIcon {
    color: var(--danger) !important;
}

.notif-warning #notificationIcon {
    color: var(--warning) !important;
}

.notif-info #notificationIcon {
    color: var(--info) !important;
}

/* --- Estilos Personalizados para SweetAlert2 --- */
.premium-swal-popup {
    font-family: 'Outfit', 'Inter', sans-serif !important;
    border-radius: var(--radius-lg) !important; /* Bordes curvos del sistema premium */
    background: var(--bg-card) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 2.5rem !important;
}

.premium-swal-popup .swal2-title {
    color: var(--primary) !important;
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.5rem !important;
    margin-top: 0.5rem !important;
}

.premium-swal-popup .swal2-html-container {
    color: var(--text-muted) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    margin-top: 1rem !important;
}

.premium-swal-popup .swal2-actions {
    margin-top: 2rem !important;
    gap: 1rem !important;
}

/* Scrollbar general */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.5);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: inset 0 0 0 10px rgba(0, 90, 156, 0.35);
}

::-webkit-scrollbar-thumb:hover {
    box-shadow: inset 0 0 0 10px var(--primary);
}

/* ====================================================================================
   ==== MEJORAS DE ADAPTABILIDAD Y COMPATIBILIDAD (PANTALLAS COMPACTAS Y 1280x720) ====
   ==================================================================================== */

@media (max-width: 1350px) {
    :root {
        --radius-md: 10px;
        --radius-lg: 16px;
    }

    body {
        font-size: 0.9rem;
    }

    /* Márgenes laterales del contenido principal */
    .tab-group,
    .tab-content,
    #institutionSelectorContainer {
        margin-left: 1.25rem !important;
        margin-right: 1.25rem !important;
    }

    /* Reducción de relleno (padding) en paneles glass y tarjetas */
    .glass-panel {
        padding: 1.25rem !important;
    }
    
    .premium-card {
        padding: 1.25rem !important;
    }

    /* Cabecera y barra superior */
    .branding-bar {
        padding: 0.6rem 1.25rem !important;
    }
    
    .premium-header {
        padding: 0.8rem 1.25rem !important;
        margin-bottom: 1.25rem !important;
    }

    .branding-left {
        gap: 1.5rem !important;
    }

    .brand-nav {
        gap: 1.25rem !important;
    }

    /* Compresión responsiva de la barra de pestañas */
    .tab-group {
        gap: 0.4rem !important;
        padding: 0.4rem !important;
        margin-bottom: 1.5rem !important;
        overflow-x: auto !important;
        max-width: calc(100% - 2.5rem) !important;
        scrollbar-width: none !important; /* Firefox */
    }

    .tab-group::-webkit-scrollbar {
        display: none !important; /* Chrome/Safari */
    }

    .tab-button {
        padding: 8px 14px !important;
        font-size: 0.82rem !important;
        gap: 5px !important;
        border-radius: 10px !important;
    }

    .tab-button i {
        font-size: 0.95rem !important;
    }

    /* Tarjetas de formulario */
    .form-section-card {
        padding: 1.25rem !important;
        margin-bottom: 1.25rem !important;
    }

    .form-section-title {
        font-size: 0.95rem !important;
        margin-bottom: 1rem !important;
    }

    /* Contenedores de tablas responsivos para evitar desbordes */
    .premium-table-container {
        overflow-x: auto !important;
        max-width: 100% !important;
    }

    .premium-table {
        min-width: 850px !important;
    }

    /* Reducción de relleno y tipografía en tablas */
    .premium-table th {
        padding: 0.75rem 0.85rem !important;
        font-size: 0.8rem !important;
    }

    .premium-table td {
        padding: 0.75rem 0.85rem !important;
        font-size: 0.82rem !important;
    }

    .action-cell {
        gap: 6px !important;
    }

    .btn-action {
        padding: 5px 12px !important;
        font-size: 0.78rem !important;
    }
}

/* Forzar colapso de grillas de 2 columnas en avisos */
@media (max-width: 1100px) {
    .notices-layout {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

/* Optimización para alturas de pantalla pequeñas (ej: 1280x720) */
@media (max-height: 750px) {
    .modal {
        padding: 0.5rem !important;
    }

    .modal-content {
        padding: 1rem !important;
        gap: 0.5rem !important;
    }

    .modal-content .premium-title {
        margin-bottom: 0.5rem !important;
        padding-bottom: 0.25rem !important;
    }

    .modal-content h3 {
        font-size: 1.15rem !important;
    }

    .modal-content p {
        font-size: 0.75rem !important;
    }
    
    #printPanelModal .modal-content {
        max-height: 96vh !important;
    }
}

/* ==========================================================================
   MEJORAS GLOBALES DE ESTÉTICA, USABILIDAD Y ACCESIBILIDAD (2026 UPDATE)
   ========================================================================== */

/* 1. Focus Ring Moderno y Accesible para Entradas y Selectores */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3.5px rgba(0, 90, 156, 0.18) !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

/* 2. Microinteracciones Táctiles en Botones */
button:not(:disabled),
.btn-action:not(:disabled),
.tab-button:not(:disabled) {
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease, background-color 0.2s ease;
}

button:not(:disabled):active,
.btn-action:not(:disabled):active {
    transform: scale(0.98);
}

/* 3. Barras de Desplazamiento Suaves y Discretas */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 90, 156, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 90, 156, 0.4);
}

/* 4. Tablas Responsivas con Sombra de Indicación de Scroll */
.table-responsive,
.table-container {
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

/* 5. Badges de Estado Modernos */
.badge-status-active {
    background-color: #dcfce7 !important;
    color: #15803d !important;
    border: 1px solid rgba(22, 163, 74, 0.2) !important;
    padding: 3px 10px !important;
    border-radius: 9999px !important;
    font-weight: 600 !important;
}

.badge-status-pending {
    background-color: #fef9c3 !important;
    color: #854d0e !important;
    border: 1px solid rgba(202, 138, 4, 0.2) !important;
    padding: 3px 10px !important;
    border-radius: 9999px !important;
    font-weight: 600 !important;
}

.badge-status-danger {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
    border: 1px solid rgba(220, 38, 38, 0.2) !important;
    padding: 3px 10px !important;
    border-radius: 9999px !important;
    font-weight: 600 !important;
}
/* =====================================================================
   RENOVACIÓN VISUAL (solo estética) — Código de color por función
   Emergencias=rojo · Reportes=naranja · Conducta=púrpura · Avisos=azul
   Estudiantes=verde · Maestros=índigo · Altas/Edición=teal/violeta
   ===================================================================== */
.tab-button { --tab-color: var(--primary); --tab-color-dark: var(--primary-dark); --tab-rgb: 0, 90, 156; position: relative; }
.tab-button[data-tab="emergencies"]       { --tab-color: #ef4444; --tab-color-dark: #b91c1c; --tab-rgb: 239, 68, 68; }
.tab-button[data-tab="reports"]           { --tab-color: #f97316; --tab-color-dark: #c2410c; --tab-rgb: 249, 115, 22; }
.tab-button[data-tab="conductReportsList"]{ --tab-color: #a855f7; --tab-color-dark: #7e22ce; --tab-rgb: 168, 85, 247; }
.tab-button[data-tab="notices"]           { --tab-color: #0ea5e9; --tab-color-dark: #0369a1; --tab-rgb: 14, 165, 233; }
.tab-button[data-tab="studentsList"]      { --tab-color: #22c55e; --tab-color-dark: #15803d; --tab-rgb: 34, 197, 94; }
.tab-button[data-tab="teachersList"]      { --tab-color: #6366f1; --tab-color-dark: #4338ca; --tab-rgb: 99, 102, 241; }
.tab-button[data-tab="addEditStudent"]    { --tab-color: #14b8a6; --tab-color-dark: #0f766e; --tab-rgb: 20, 184, 166; }
.tab-button[data-tab="addEditTeacher"]    { --tab-color: #8b5cf6; --tab-color-dark: #6d28d9; --tab-rgb: 139, 92, 246; }
/* Super Admin */
.tab-button[data-tab="gestion"]      { --tab-color: #005a9c; --tab-color-dark: #003f6d; --tab-rgb: 0, 90, 156; }
.tab-button[data-tab="estadisticas"] { --tab-color: #6366f1; --tab-color-dark: #4338ca; --tab-rgb: 99, 102, 241; }
.tab-button[data-tab="cctv"]         { --tab-color: #475569; --tab-color-dark: #1e293b; --tab-rgb: 71, 85, 105; }
.tab-button[data-tab="noticias"]     { --tab-color: #f59e0b; --tab-color-dark: #b45309; --tab-rgb: 245, 158, 11; }
.tab-button[data-tab="ventas"]       { --tab-color: #22c55e; --tab-color-dark: #15803d; --tab-rgb: 34, 197, 94; }
.tab-button[data-tab="telegram"]     { --tab-color: #229ed9; --tab-color-dark: #0e76a8; --tab-rgb: 34, 158, 217; }

.tab-button i { color: var(--tab-color); opacity: 0.9; }
.tab-button:hover {
    background: rgba(var(--tab-rgb), 0.10);
    color: var(--tab-color-dark);
}
.tab-button.active {
    background: linear-gradient(135deg, var(--tab-color), var(--tab-color-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(var(--tab-rgb), 0.35);
}
.tab-button.active i { color: #fff !important; }

/* Contenedores de pestañas: scroll horizontal en lugar de desbordar */
.tab-group { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.tab-container { flex-wrap: wrap; }

/* Franja de color en el título de cada sección, según la pestaña */
#emergenciesContent .premium-title::before        { background: #ef4444; }
#reportsContent .premium-title::before            { background: #f97316; }
#conductReportsListContent .premium-title::before { background: #a855f7; }
#noticesContent .premium-title::before            { background: #0ea5e9; }
#studentsListContent .premium-title::before       { background: #22c55e; }
#teachersListContent .premium-title::before       { background: #6366f1; }
#addEditStudentContent .premium-title::before     { background: #14b8a6; }
#addEditTeacherContent .premium-title::before     { background: #8b5cf6; }
#gestionContent .premium-title::before            { background: #005a9c; }
#noticiasContent .premium-title::before           { background: #f59e0b; }
#ventasContent .premium-title::before             { background: #22c55e; }
#telegramContent .premium-title::before           { background: #229ed9; }

/* Encabezado de tabla con acento de color por sección */
#emergenciesContent .premium-table thead th        { border-bottom-color: #ef4444; box-shadow: inset 0 -3px 0 #ef4444; }
#reportsContent .premium-table thead th            { border-bottom-color: #f97316; box-shadow: inset 0 -3px 0 #f97316; }
#conductReportsListContent .premium-table thead th { border-bottom-color: #a855f7; box-shadow: inset 0 -3px 0 #a855f7; }
#studentsListContent .premium-table thead th       { border-bottom-color: #22c55e; box-shadow: inset 0 -3px 0 #22c55e; }
#teachersListContent .premium-table thead th       { border-bottom-color: #6366f1; box-shadow: inset 0 -3px 0 #6366f1; }

/* Tablas: sin traslapes de columnas, lectura clara */
.premium-table-container, .table-container { overflow-x: auto !important; }
.premium-table { min-width: 900px; }
#studentsListContent .premium-table { min-width: 1400px; }
#reportsContent .premium-table { min-width: 1000px; }
#teachersListContent .premium-table { min-width: 1000px; }
.premium-table thead th { white-space: nowrap; padding: 0.9rem 0.8rem; }
.premium-table td { padding: 0.85rem 0.8rem; word-break: break-word; overflow-wrap: anywhere; }
.premium-table td.truncated-cell, .premium-table td[style*="ellipsis"] { overflow-wrap: normal; word-break: normal; }
.premium-table tbody tr:nth-child(even) { background: rgba(0, 90, 156, 0.025); }
.premium-table tbody tr:hover { background: rgba(0, 90, 156, 0.07); transform: none; }
.action-cell, td .action-cell { flex-wrap: wrap; }
.status-badge { white-space: nowrap; }

/* Super admin: tablas genéricas */
#institutionsTable, #telegramTable, #newsTable, #videosTable { min-width: 800px; }
#institutionsTable th, #telegramTable th, #newsTable th, #videosTable th { white-space: nowrap; }
#institutionsTable tbody tr:nth-child(even), #telegramTable tbody tr:nth-child(even) { background: rgba(0, 90, 156, 0.025); }

/* =====================================================================
   TABLA DE REPORTES / INCIDENTES (Perfil Anónimo y Columnas Holgadas)
   ===================================================================== */
#reportsContent .premium-table,
.reports-table {
    min-width: 1100px;
    table-layout: auto !important;
    width: 100%;
}

.reports-table th {
    white-space: nowrap;
    vertical-align: middle;
}

.reports-table td.cell-date {
    white-space: nowrap;
    min-width: 120px;
}

.reports-table td.cell-demographics {
    min-width: 155px;
    white-space: nowrap;
}

.reports-table .demographics-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}

.badge-gender {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.badge-gender.gender-female {
    background: rgba(236, 72, 153, 0.1);
    color: #db2777;
    border: 1px solid rgba(236, 72, 153, 0.25);
}

.badge-gender.gender-male {
    background: rgba(14, 165, 233, 0.1);
    color: #0284c7;
    border: 1px solid rgba(14, 165, 233, 0.25);
}

.badge-gender.gender-neutral {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.reports-table td.cell-type {
    min-width: 140px;
    white-space: nowrap;
}

.reports-table td.cell-type .badge-type {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-size: 0.78rem;
}

.reports-table td.cell-description {
    min-width: 280px;
    max-width: 500px;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.45;
    font-size: 0.85rem;
    color: #334155;
}

.reports-table td.cell-location,
.reports-table td.cell-status,
.reports-table td.cell-management {
    white-space: nowrap;
}

