@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --bg-body: #f8fafc;
    --bg-sidebar: #0f172a;
    --text-sidebar: #94a3b8;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- SIDEBAR PREMIUM --- */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.brand {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand h1 {
    font-size: 1.1rem;
    margin: 0;
    color: white;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar nav::-webkit-scrollbar {
    width: 14px;
}

.sidebar nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.sidebar nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid transparent;
    background-clip: content-box;
}

.nav-link {
    padding: 0.85rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 12px;
    margin-bottom: 4px;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(5px);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.25) 0%, transparent 100%);
    color: #60a5fa;
    font-weight: 700;
    border-left: 4px solid #3b82f6;
}

.nav-category {
    padding: 1.5rem 1rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-category::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(51, 65, 85, 0.5);
}

/* --- SIDEBAR COLLAPSED STATE --- */
.sidebar { transition: width 0.30s cubic-bezier(0.4, 0, 0.2, 1); position: relative; }

.sidebar.collapsed { width: 80px; }
.sidebar.collapsed .brand-text, 
.sidebar.collapsed .nav-link span, 
.sidebar.collapsed .user-info div, 
.sidebar.collapsed .nav-category::after,
.sidebar.collapsed .nav-category { display: none !important; }

.sidebar.collapsed .nav-link { justify-content: center; padding: 0.85rem; width: 50px; margin: 4px auto; }
.sidebar.collapsed .nav-link i, 
.sidebar.collapsed .nav-link svg { font-size: 1.4rem; margin: 0; }
.sidebar.collapsed .brand { padding: 1.5rem 0.5rem; justify-content: center; align-items: center; }
.sidebar.collapsed .user-info { justify-content: center; padding: 0.75rem 0; border: none; background: transparent; }
.sidebar.collapsed .user-info img { width: 40px; height: 40px; }

.sidebar-toggle-btn { 
    background: rgba(255,255,255,0.05); 
    border: 1px solid rgba(255,255,255,0.1); 
    color: white; 
    width: 28px; 
    height: 28px; 
    border-radius: 6px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 0.8rem; 
    transition: all 0.2s;
    outline: none;
}
.sidebar-toggle-btn:hover { background: var(--primary); border-color: var(--primary); }
.sidebar.collapsed .sidebar-toggle-btn { transform: rotate(180deg); }

#main-content { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

.nav-group.special {
    background: rgba(30, 41, 59, 0.4);
    margin: 0.25rem 0;
    padding: 0.25rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.nav-category.highlight {
    color: #38bdf8;
}

/* --- MAIN CONTENT --- */
#main-content {
    flex: 1;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    padding: 2rem;
    background: #f8fafc;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Forzar que el cuerpo permita el flujo si es necesario */
body.modal-open {
    overflow: hidden;
}

.mobile-header {
    display: none;
    background: #0f172a;
    color: white;
    padding: 1rem;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 200;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    box-shadow: none;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
    box-shadow: none;
}

/* --- SUBMENU --- */
.sidebar-submenu {
    display: none;
    flex-direction: column;
    padding-left: 1rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    margin: 0.25rem 0.5rem 0.5rem 0.5rem;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}
.sidebar-submenu.show { display: flex; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.subitem { font-size: 0.85rem !important; padding: 0.65rem 1rem !important; opacity: 0.8; }
.subitem:hover { opacity: 1; background: rgba(255, 255, 255, 0.05); }
.subitem.active { background: rgba(37, 99, 235, 0.1) !important; border-left-width: 3px !important; color: #60a5fa !important; }
.submenu-trigger { cursor: pointer; width: 100%; text-align: left; justify-content: space-between !important; background: none; border: none; box-shadow: none !important; }
.submenu-trigger:hover { transform: none !important; }

@media (max-width: 900px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        width: 280px;
    }

    .sidebar.show {
        left: 0;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.4);
    }

    .mobile-header {
        display: flex;
    }

    main {
        padding: 1.25rem;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}


@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
}

main::-webkit-scrollbar {
    width: 10px;
}

main::-webkit-scrollbar-track {
    background: #f1f5f9;
}

main::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
    border: 2px solid #f1f5f9;
}

main::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.04em;
    margin: 0;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

/* --- BUTTONS --- */
button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    font-family: inherit;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -5px rgba(37, 99, 235, 0.3);
}

button:active {
    transform: translateY(0);
}

button.secondary {
    background-color: white;
    color: #475569;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
}

button.secondary:hover {
    background-color: #f8fafc;
    color: #1e293b;
    border-color: #cbd5e1;
}

button.danger:hover {
    background-color: #fee2e2;
    transform: translateY(-2px);
}

button.success {
    background-color: #10b981;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

button.success:hover {
    background-color: #059669;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

button.small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 10px;
}

/* --- CARDS --- */
.card {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #f1f5f9;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #e2e8f0;
}

/* --- TABLES --- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
}

th {
    background-color: #f8fafc;
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid #f1f5f9;
    text-align: left;
}

td {
    padding: 1.25rem 1.5rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}

tr:hover td {
    background-color: #fcfdfe;
}

tr:last-child td {
    border-bottom: none;
}

.tag {
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    letter-spacing: 0.02em;
}

.tag.primary {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #dbeafe;
}

.tag.success {
    background: #f0fdf4;
    color: #15803d;
    border-color: #dcfce7;
}

.tag.warning {
    background: #fffbeb;
    color: #b45309;
    border-color: #fef3c7;
}

.tag.danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fee2e2;
}

/* --- FORMS --- */
input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #475569;
}

/* --- MODALS --- */
.modal-overlay {
    backdrop-filter: blur(12px);
    background: rgba(15, 23, 42, 0.4);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 32px;
    width: 95%;
    max-width: 850px;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    animation: modalSlide 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 1.75rem 2.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 2.5rem;
    flex: 1;
    overflow-y: auto;
}

/* --- TABS SYSTEM --- */
.tabs,
.fin-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 0;
    margin-bottom: 2rem;
}

.tab-btn,
.fin-tab-btn {
    background: none;
    border: none;
    box-shadow: none;
    color: #64748b;
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 0;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover,
.fin-tab-btn:hover {
    background: #f8fafc;
    color: #1e293b;
    transform: none;
    box-shadow: none;
}

.tab-btn.active,
.fin-tab-btn.active {
    color: #ffffff !important;
    background-color: #2563eb !important;
    border-bottom-color: #1d4ed8 !important;
}

.modal-full {
    max-width: 100% !important;
    width: 100% !important;
    height: 100vh;
    border-radius: 0 !important;
    margin: 0 !important;
}

.modal-full .modal-content {
    border-radius: 0 !important;
    height: 100% !important;
}

.modal-full .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2.5rem;
}

.modal-xl {
    max-width: 1200px !important;
    width: 96%;
    max-height: 96vh !important;
}

.modal-lg {
    max-width: 950px !important;
    width: 95%;
}

.modal-footer,
.form-actions {
    padding: 1.5rem 2.5rem;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 1.25rem;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
}

.modal-header h2,
.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.small-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.small-table th {
    text-align: left;
    padding: 0.75rem;
    background: #f8fafc;
    color: #64748b;
    font-weight: 700;
    border-bottom: 2px solid #f1f5f9;
}

.small-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.small-table tr:hover {
    background: #f1f5f9;
}

.form-group {
    margin-bottom: 1.25rem;
}

.close-modal {
    font-size: 1.75rem;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    box-shadow: none;
    padding: 0;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #475569;
    transform: none;
}

/* Loader */
.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--primary-light);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- LOGIN PAGE --- */
.login-page {
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, #1e3a8a, #0f172a);
    position: relative;
    overflow-y: auto;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background: url('https://www.transparenttextures.com/patterns/cubes.png');
    opacity: 0.05;
    animation: rotateBg 100s linear infinite;
}

@keyframes rotateBg {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 32px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: loginFade 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFade {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h1 {
    font-size: 2rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.login-header p {
    color: #64748b;
    font-size: 0.95rem;
}

.login-card .form-group {
    margin-bottom: 1.5rem;
}

.login-card label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 0.85rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.login-card input {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 2px solid #f1f5f9;
    background: #f8fafc;
    font-size: 1rem;
    transition: all 0.2s;
}

.login-card input:focus {
    border-color: #2563eb;
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.btn-login {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 1rem;
    justify-content: center;
}

.btn-portal {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: #0369a1;
    color: white;
    border: 2px solid #0284c7;
    border-radius: 12px;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-portal:hover {
    background: #075985;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(3, 105, 161, 0.3);
    color: white;
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: #94a3b8;
}

.login-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid #fee2e2;
}

#developer-credits {
    transition: all 0.3s;
}

#developer-credits:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    background: white !important;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 4px 25px rgba(16, 185, 129, 0.5);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    }
}

/* --- CALENDAR VIEW STYLES --- */
.calendar-container {
    background: white;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: #e2e8f0;
    gap: 1px;
}

.calendar-day-head {
    background-color: #f8fafc;
    padding: 1rem;
    text-align: center;
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.05em;
}

.calendar-day {
    background-color: white;
    min-height: 120px;
    padding: 0.5rem;
    position: relative;
    transition: background-color 0.2s;
}

.calendar-day:hover {
    background-color: #fcfdfe;
}

.calendar-day.other-month {
    background-color: #f1f5f9;
    color: #94a3b8;
}

.calendar-day-num {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-event {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 6px;
    background: #eff6ff;
    color: #1e40af;
    border-left: 3px solid #3b82f6;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    transition: transform 0.1s;
}

.calendar-event:hover {
    transform: scale(1.02);
    filter: brightness(0.95);
}

.calendar-event.notificado {
    background: #f0fdf4;
    color: #166534;
    border-left-color: #22c55e;
}

.calendar-event.bimestral {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.calendar-event.practica {
    background: #f0f9ff;
    color: #0369a1;
    border-left-color: #0ea5e9;
}

.view-toggle {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.view-toggle button {
    background: none;
    color: #64748b;
    box-shadow: none;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.view-toggle button:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: none;
}

.view-toggle button.active {
    background: white;
    color: #1e293b;
    box-shadow: var(--shadow-sm);
}

/* --- STATS PANEL --- */
.stats-panel {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    flex: 1;
    border: 1px solid #f1f5f9;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

/* --- WELLBEING & UI --- */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: white;
    padding: 1.75rem;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid #f1f5f9;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h4 {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-info .value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    display: block;
}

/* Timeline Premium */
.timeline-wrapper {
    position: relative;
    padding: 1rem 0;
}

.timeline-wrapper::before {
    content: '';
    position: absolute;
    left: 21px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary-light) 0%, #f1f5f9 100%);
    border-radius: 10px;
}

.timeline-item {
    position: relative;
    padding-left: 60px;
    margin-bottom: 2.5rem;
    animation: fadeInSlide 0.5s ease-out forwards;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 5px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    border: 4px solid var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 0 0 4px white;
    color: var(--primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.1);
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.timeline-content {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid #f1f5f9;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.timeline-item:hover .timeline-content {
    box-shadow: var(--shadow-md);
    border-color: #e2e8f0;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.timeline-title {
    font-weight: 800;
    color: #1e293b;
    font-size: 1.1rem;
    margin: 0;
}

.timeline-date {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 600;
    background: #f8fafc;
    padding: 4px 10px;
    border-radius: 8px;
}

.timeline-body {
    color: #475569;
    line-height: 1.6;
    font-size: 0.95rem;
}

.timeline-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #f1f5f9;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.timeline-meta {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* CASE CARDS */
.case-card-mini {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    margin-top: 0.75rem;
}

.riesgo-chip {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.riesgo-bajo { background: #dcfce7; color: #166534; }
.riesgo-medio { background: #fef9c3; color: #854d0e; }
.riesgo-alto { background: #fee2e2; color: #991b1b; }

/* SEARCH BAR PREMIUM */
.premium-search-container {
    background: white;
    padding: 1rem;
    border-radius: 20px;
    display: flex;
    gap: 1rem;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid #f1f5f9;
    margin-bottom: 2rem;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-input-wrapper i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.search-input-wrapper input {
    padding-left: 3rem;
    background: #f8fafc;
    border-color: transparent;
}

.search-input-wrapper input:focus {
    background: white;
    border-color: var(--primary);
}
/* ADVANCED STUDENT SELECTOR */
.student-selector-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input-wrapper,
#search-person-container,
#search-container-jec {
    position: relative;
}

.search-results-popover {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 15px 30px -10px rgba(0,0,0,0.2);
    border: 1px solid #e2e8f0;
    z-index: 9999;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 5px;
    display: none;
    width: 100%;
    min-width: 300px;
}

.search-results-popover.show {
    display: block;
    animation: fadeInDown 0.2s ease-out;
}

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

.student-result-item {
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

.student-result-item:last-child {
    border-bottom: none;
}

.student-result-item:hover {
    background: #f8fafc;
}

.student-result-item .avatar-mini {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
}

.student-result-item .info .name {
    font-weight: 700;
    display: block;
    color: #1e293b;
    font-size: 0.95rem;
}

.student-result-item .info .details {
    font-size: 0.75rem;
    color: #64748b;
}

.selected-student-badge {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    padding: 1rem;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.selected-student-badge .info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.selected-student-badge .name {
    font-weight: 800;
    color: #1d4ed8;
}

.selected-student-badge .remove-btn {
    color: #ef4444;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.selected-student-badge .remove-btn:hover {
    background: #fee2e2;
}
/* --- APERTURA DE CASO PREMIUM --- */
.form-section {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.section-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f8fafc;
}

.section-title i {
    color: var(--primary);
}

.selected-student-premium {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #f0f7ff;
    border: 2px solid #3b82f633;
    border-radius: 20px;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

.avatar-large {
    width: 70px;
    height: 70px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 900;
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.student-info-main {
    flex: 1;
}

.student-info-main .name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
}

.student-info-main .meta {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
}

.btn-icon-danger {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-danger:hover {
    background: #dc2626;
    color: white;
    transform: rotate(90deg);
}

/* Risk Selector Cards */
.risk-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.risk-card {
    cursor: pointer;
}

.risk-card input {
    display: none;
}

.risk-card-content {
    padding: 1.25rem;
    border-radius: 16px;
    border: 2px solid #f1f5f9;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    background: white;
}

.risk-card-content i {
    font-size: 1.5rem;
}

.risk-card-content span {
    font-weight: 800;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.risk-card input:checked + .risk-card-content.bajo {
    border-color: #10b981;
    background: #ecfdf5;
    color: #065f46;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.risk-card input:checked + .risk-card-content.medio {
    border-color: #f59e0b;
    background: #fffbeb;
    color: #92400e;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.risk-card input:checked + .risk-card-content.alto {
    border-color: #ef4444;
    background: #fef2f2;
    color: #991b1b;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.selected-person-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 100px;
    font-weight: 700;
    color: #1e293b;
    animation: fadeIn 0.2s ease-out;
}

.selected-person-badge .remove-icon {
    cursor: pointer;
    color: #94a3b8;
}

.selected-person-badge .remove-icon:hover {
    color: #ef4444;
}

.select-premium {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    font-weight: 600;
    background: #f8fafc;
    cursor: pointer;
}

.select-premium:focus {
    border-color: var(--primary);
    background: white;
}
.quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quick-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.quick-tag:hover {
    background: #e2e8f0;
    color: var(--primary);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* --- DISEÑO DE LINEA DE TIEMPO V2 --- */
.timeline-layout-v2 {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    align-items: start;
}

.timeline-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-actions-sidebar {
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.timeline-actions-sidebar h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.timeline-actions-sidebar button {
    width: 100%;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.timeline-actions-sidebar button:hover {
    transform: translateX(5px);
}

@media (max-width: 1100px) {
    .timeline-layout-v2 {
        grid-template-columns: 1fr;
    }
    .timeline-sidebar {
        position: static;
    }
}

/* --- UTILITIES & FIXES --- */
.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.gap-05 { gap: 0.5rem !important; }
.gap-1 { gap: 1rem !important; }
.gap-1-5 { gap: 1.5rem !important; }
.gap-2 { gap: 2rem !important; }

.ta-r { text-align: right !important; }
.ta-c { text-align: center !important; }
.ta-l { text-align: left !important; }

.bold { font-weight: 700 !important; }
.extrabold { font-weight: 800 !important; }
.small { font-size: 0.85rem !important; }
.tiny { font-size: 0.75rem !important; }

.text-muted { color: #64748b !important; }
.text-danger { color: #ef4444 !important; }
.text-success { color: #10b981 !important; }
.text-primary { color: var(--primary) !important; }

.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-05 { margin-top: 0.5rem !important; }
.mt-1 { margin-top: 1rem !important; }
.mt-2 { margin-top: 2rem !important; }
.mb-05 { margin-bottom: 0.5rem !important; }
.mb-1 { margin-bottom: 1rem !important; }
.mb-2 { margin-bottom: 2rem !important; }
.ml-05 { margin-left: 0.5rem !important; }
.mr-05 { margin-right: 0.5rem !important; }

.p-05 { padding: 0.5rem !important; }
.p-075 { padding: 0.75rem !important; }
.p-1 { padding: 1rem !important; }
.p-15 { padding: 1.5rem !important; }
.p-2 { padding: 2rem !important; }

.w-100 { width: 100% !important; }
.full-width { width: 100% !important; }
.border-bottom { border-bottom: 1px solid #f1f5f9 !important; }
.border-rounded { border-radius: 12px !important; }

/* Custom button small adjustments for premium look in tables */
button.small.secondary {
    padding: 0.4rem 0.8rem !important;
    border-radius: 14px !important;
    box-shadow: none !important;
    border: 1.5px solid #f1f5f9 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button.small.secondary:hover {
    background: #f8fafc !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    transform: translateY(-1px);
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

/* --- PREMIUM UI COMPONENTS --- */
.loader-premium {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--primary);
}

.loader-premium .spinner {
    width: 60px;
    height: 60px;
    border: 6px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    margin-bottom: 1.5rem;
}

.btn-premium {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white !important;
    padding: 0.85rem 1.75rem;
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-premium:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px -10px rgba(79, 70, 229, 0.5);
    filter: brightness(1.1);
}

.btn-premium.sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 12px;
}

.premium-search-container {
    background: white;
    padding: 1.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 1.25rem;
    color: #94a3b8;
    font-size: 1.1rem;
}

.search-input-wrapper input {
    padding-left: 3.25rem;
    height: 54px;
    font-size: 1.05rem;
    border-radius: 16px;
    background: #f8fafc;
    border: 2px solid #f1f5f9;
}

.search-input-wrapper input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
}

.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.premium-table th {
    background: #f8fafc;
    padding: 1.25rem 1.5rem;
    color: #64748b;
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #f1f5f9;
}

.premium-table td {
    padding: 1.5rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.premium-table tr:last-child td {
    border-bottom: none;
}

.premium-table tr:hover td {
    background: #fcfdfe;
}

.avatar-sm {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.5rem;
    border: 2px solid white;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.avatar-md {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255,255,255,0.2);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-action {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #475569;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-action:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-main);
}

.btn-action.primary {
    background: var(--primary-light);
    color: var(--primary);
    border-color: transparent;
}

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

.btn-action.sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
}

/* --- TIMELINE --- */
.timeline {
    position: relative;
    padding-left: 1rem;
    border-left: 2px solid #e2e8f0;
    margin-left: 0.5rem;
}

.timeline-item {
    position: relative;
    padding-left: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.45rem;
    top: 0.75rem;
    width: 12px;
    height: 12px;
    background: white;
    border: 3px solid var(--primary);
    border-radius: 50%;
    z-index: 2;
}

.border-left-primary {
    border-left: 5px solid var(--primary) !important;
}

.border-left-danger {
    border-left: 5px solid #ef4444 !important;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f1f5f9;
    color: #0f172a;
    font-weight: 800;
    font-size: 1.1rem;
}

.info-alert {
    background: #eff6ff;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid #dbeafe;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
}

@media (max-width: 900px) {
    .mobile-only {
        display: block !important;
    }
}


/* --- PAGINATION & OPTIMIZATION --- */
.p-btn { background: white; color: #475569; border: 1px solid #e2e8f0; padding: 0.5rem 1.25rem; border-radius: 50px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.p-btn:hover:not(:disabled) { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; transform: translateY(-1px); }
.p-btn:disabled { opacity: 0.5; cursor: not-allowed; background: #f1f5f9; }
.spinner-small { width: 20px; height: 20px; border: 3px solid rgba(37, 99, 235, 0.1); border-top-color: var(--primary); border-radius: 50%; animation: rotation 0.8s linear infinite; }
.loader-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(2px); display: flex; justify-content: center; align-items: center; z-index: 50; border-radius: 24px; }

/* --- CALENDARIO INSTITUCIONAL --- */
.calendar-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #dadce0;
    margin: -1rem 0 1rem 0; /* Quitamos el auto para que use todo el ancho */
    width: 100%;
    max-width: 100%;
}

.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.calendar-controls h3 {
    font-size: 1.5rem;
    font-weight: 800;
    min-width: 200px;
    text-align: center;
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 500;
    color: #70757a;
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid #edf2f7;
    border-left: 1px solid #edf2f7;
    background: white;
    border-radius: 4px;
    overflow: hidden;
}

.calendar-day {
    height: 125px; /* Ajustado para mejor proporción en pantallas anchas */
    background: white;
    padding: 6px;
    border-right: 1px solid #edf2f7;
    border-bottom: 1px solid #edf2f7;
    transition: background 0.1s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover {
    background: #f8fafc;
    z-index: 5;
}

.calendar-day.empty {
    background: transparent;
    border: none;
}

.calendar-day.today {
    background: white;
}

.calendar-day.today .day-number {
    background: #1a73e8;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px auto 6px auto;
    font-weight: 700;
}

.day-number {
    font-weight: 500;
    font-size: 0.8rem;
    color: #3c4043;
    text-align: center;
    margin-bottom: 8px;
    padding-top: 4px;
}

.calendar-day.other-month {
    background: #fcfdfe;
    color: #bdc1c6;
}

.calendar-day.other-month .day-number {
    color: #bdc1c6;
    opacity: 0.5;
}

.events-container {
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
}

.events-container::-webkit-scrollbar {
    width: 3px;
}

.events-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.event-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: all 0.1s;
    margin-bottom: 2px;
    color: white;
    border: none;
    line-height: 1.2;
}

.event-tag:hover {
    filter: saturate(1.5) brightness(0.9);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.event-tag:hover {
    filter: brightness(0.9);
}

.year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.mini-month-card {
    background: white;
    border-radius: 20px;
    padding: 1.25rem;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.mini-month-card:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

.mini-month-card h4 {
    margin: 0 0 1rem 0;
    color: var(--primary);
    font-weight: 800;
}

.mini-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.6rem;
    font-weight: 800;
    color: #94a3b8;
    margin-bottom: 5px;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.mini-day {
    font-size: 0.7rem;
    text-align: center;
    padding: 4px 0;
    border-radius: 4px;
    color: #64748b;
}

.mini-day.has-event {
    background: var(--primary);
    color: white;
    font-weight: 800;
}

.icon-btn {
    background: #f1f5f9;
    color: #475569;
    width: 40px; height: 40px;
    border-radius: 50%;
    padding: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.icon-btn:hover {
    background: #e2e8f0;
}

/* --- GLOBAL MOBILE RESPONSIVENESS (APPLIES TO ALL VIEWS) --- */
@media (max-width: 768px) {
    /* 1. Modals */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        max-height: 90vh !important;
    }
    .modal-header { padding: 1.25rem 1.5rem !important; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .modal-body { padding: 1.25rem 1.5rem !important; }
    .modal-footer { padding: 1.25rem 1.5rem !important; flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .modal-footer button { width: 100%; margin: 0; }
    
    /* 2. Tables and Cards */
    .table-container, .card, [style*="overflow-x: auto"] {
        padding: 1rem !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    table { min-width: 650px !important; }
    
    /* 3. Header Sections & Actions */
    .header-actions, .header-section, [style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center;
        gap: 1rem !important;
    }
    
    /* 4. Grids */
    .grid-2, .grid-3, .grid-4, .grid-5, .stats-container, .dashboard-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    /* 5. Flex Layouts and Search Inputs */
    .d-flex, .premium-search-container > div, .gap-3, [style*="display: flex"] {
        flex-wrap: wrap !important;
    }
    .search-input-wrapper {
        min-width: 100% !important;
        width: 100% !important;
        flex: 1 1 100% !important;
        margin-bottom: 0.5rem;
    }
    .search-input-wrapper input {
        width: 100% !important;
    }
    
    /* 6. Tabs & Pills */
    .tabs, .fin-tabs, #tutoria-tabs, #psico-tabs {
        flex-wrap: wrap;
        justify-content: center !important;
        overflow-x: auto;
    }
    
    /* 7. Forms and Inputs */
    .form-group, .form-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* 8. Fix specific dashboard stat cards */
    .stat-card {
        width: 100% !important;
    }
    
    
    /* 9. Typography adjustments */
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.25rem !important; }
    h3 { font-size: 1.1rem !important; }
    
    /* 10. QR Scanner fixes */
    .qr-success-card {
        padding: 0.8rem !important;
        border-radius: 12px !important;
        gap: 0.8rem !important;
        text-align: left !important;
    }
    .qr-avatar-container {
        width: 70px !important;
        height: 70px !important;
    }
    .qr-text-container {
        text-align: left !important;
    }
    .qr-tags-container {
        justify-content: flex-start !important;
    }
}
