:root {
    --primary: #0369a1;
    --primary-hover: #075985;
    --bg-color: #f8f9fa;
    --sidebar-bg: #ffffff;
    --text-main: #2b2d42;
    --text-muted: #8d99ae;
    --card-bg: #ffffff;
    --border: #e9ecef;
    --success: #2a9d8f;
    --danger: #e63946;




    /* ==========================================
   📱 MOBILE RESPONSIVE DESIGN (Max Width: 850px)
   ========================================== */

/* Mobile Menu Button & Overlay (Hidden on Desktop) */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    align-items: center;
    justify-content: center;
}
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-overlay.active { display: block; opacity: 1; }

@media (max-width: 850px) {
    /* Show mobile button */
    .mobile-menu-btn { display: flex; }
    
    /* Convert Sidebar to Slide-in Off-Canvas Menu */
    .sidebar {
        position: fixed;
        left: -300px; /* Hide completely off-screen */
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 15px rgba(0,0,0,0.2);
    }
    .sidebar.active { transform: translateX(300px); } /* Slide in */
    
    /* Adjust Main Content Area */
    .main-content { 
        padding: 70px 15px 20px 15px; /* Extra top padding so content isn't hidden under the hamburger button */
    }
    
    /* Stack Headers & Adjust Typography */
    header { flex-direction: column; align-items: flex-start; gap: 10px; }
    header h1 { font-size: 22px; }
    .analytics-filters { flex-wrap: wrap; width: 100%; }
    .filter-btn { flex: 1; text-align: center; font-size: 11px; padding: 8px; }
    
    /* Stack Forms into Single Columns */
    .form-grid { grid-template-columns: 1fr; }
    .fee-type-toggle { flex-direction: column; gap: 15px; }
    
    /* Adjust Modal (Popups) for Small Screens */
    .premium-modal { width: 95%; max-height: 90vh; display: flex; flex-direction: column;}
    .modal-header { padding: 20px; }
    .modal-header h2 { font-size: 18px; flex-wrap: wrap; }
    .modal-body-content { 
        grid-template-columns: 1fr; /* Force single column on mobile */
        padding: 15px;
        gap: 15px;
    }
    .close-btn { top: 15px; right: 15px; font-size: 24px; }
    
    /* Ensure Tables are horizontally swipeable */
    .table-responsive { 
        width: 100%; 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        box-shadow: inset -10px 0 10px -10px rgba(0,0,0,0.1); /* Hint that there is more content to the right */
    }
}
}

[data-theme="dark"] {
    --bg-color: #121212;
    --sidebar-bg: #1e1e1e;
    --text-main: #ffffff;
    --text-muted: #adb5bd;
    --card-bg: #1e1e1e;
    --border: #333333;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body { display: flex; height: 100vh; background-color: var(--bg-color); color: var(--text-main); transition: 0.3s; }

/* Layout */
.sidebar { width: 250px; background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px; }
.sidebar h2 { margin-bottom: 30px; color: #ffb703; }

nav { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.nav-btn { background: none; border: none; text-align: left; padding: 12px; font-size: 16px; border-radius: 8px; cursor: pointer; color: var(--text-main); transition: 0.2s; }
.nav-btn:hover, .nav-btn.active { background: var(--primary); color: white; }
.sidebar-footer { display: flex; flex-direction: column; gap: 10px; }
.sidebar-footer button { padding: 10px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-main); border-radius: 8px; cursor: pointer; }

.main-content { flex: 1; padding: 30px; overflow-y: auto; }
.page-section { display: none; animation: fadeIn 0.3s ease-in-out; }
.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Typography & Cards */
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card { background: var(--card-bg); padding: 20px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 1px solid var(--border); }
.mt-2 { margin-top: 20px; }

/* Dashboard Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.stat-card { background: var(--card-bg); padding: 20px; border-radius: 12px; border: 1px solid var(--border); text-align: center; }
.stat-card h3 { color: var(--text-muted); font-size: 14px; margin-bottom: 10px; }
.stat-card h2 { font-size: 24px; color: var(--primary); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; margin-bottom: 20px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 14px; font-weight: 600; }
input, select { padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-color); color: var(--text-main); }
.btn-primary { background: var(--primary); color: white; border: none; padding: 12px 20px; border-radius: 6px; cursor: pointer; font-size: 16px; width: 100%; transition: 0.2s; }
.btn-primary:hover { background: var(--primary-hover); }

/* Tables */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; }
.btn-sm { padding: 5px 10px; background: var(--primary); color: white; border: none; border-radius: 4px; cursor: pointer; }

/* Utilities */
.hidden { display: none !important; }
.student-info-box { background: var(--bg-color); padding: 15px; border-radius: 6px; margin-bottom: 20px; border: 1px solid var(--border); }
.filters { display: flex; gap: 10px; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; }
.modal.active { display: flex; }
.modal-content { background: var(--card-bg); padding: 25px; border-radius: 12px; width: 500px; max-width: 70%; max-height: 80vh; overflow-y: auto; position: relative; }
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 24px; cursor: pointer; }

/* Print Styles - Crucial for Receipt */
.receipt-area { display: none; padding: 40px; text-align: center; font-family: monospace; }
@media print {
    
    body * { visibility: hidden; }
    #receipt-area, #receipt-area * { visibility: visible; }
    #receipt-area { display: block; position: absolute; left: 0; top: 0; width: 100%; }
    .sidebar, .main-content { display: none; }
}
/* --- Premium Receipt Styles --- */
.premium-receipt {
    display: none;
    background: #fff;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Print Specific Rules */
@media print {
    @page { size: A4 landscape; margin: 0; }
    body { background: #fff; margin: 0; padding: 0; }
    body * { visibility: hidden; }
    
    .sidebar, .main-content { display: none !important; }
    
    .premium-receipt, .premium-receipt * { visibility: visible; }
    .premium-receipt {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 40px;
        box-sizing: border-box;
    }

    .receipt-inner {
        border: 2px solid #2b2d42;
        padding: 40px;
        border-radius: 8px;
        background: #fff;
    }

    /* Header */
    .receipt-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 20px;
        border-radius: 10px;
    }
   
    .institute-details h1 { font-size: 5px; color: #2b2d42; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 1px;}
    .institute-details p { font-size: 12px; color: #555; margin-bottom: 3px; }
    
    .receipt-title-box { text-align: right; }
    .receipt-title-box h2 { color: #4371ee; margin-bottom: 15px; letter-spacing: 2px; }
    .meta-row { font-size: 14px; margin-bottom: 5px; }
    .meta-row span { color: #ffffff; display: inline-block; width: 80px; text-align: left;}

    .receipt-divider { border: none; border-top: 2px solid #edf2f4; margin: 25px 0; }

    /* Student Grid */
    .student-details-grid {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        gap: 20px;
        background: #f8f9fa;
        padding: 20px;
        border-radius: 6px;
        margin-bottom: 30px;
        border: 1px solid #e9ecef;
    }
    .label { font-size: 11px; text-transform: uppercase; color: #8d99ae; font-weight: bold; margin-bottom: 5px; }
    .student-details-grid h3 { font-size: 18px; color: #2b2d42; margin: 0; }
    .value { font-size: 14px; font-weight: 600; color: #2b2d42; }

    /* Table */
    .receipt-table-container h3 { font-size: 16px; margin-bottom: 15px; color: #2b2d42; }
    .receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
    .receipt-table th { background: #2b2d42; color: #fff; padding: 12px; text-align: left; font-size: 13px; font-weight: 600; }
    .receipt-table td { padding: 12px; border-bottom: 1px solid #e9ecef; font-size: 14px; color: #333; }
    .align-right { text-align: right !important; }

    /* Summary */
    .financial-summary {
        width: 350px;
        float: right;
        margin-bottom: 40px;
    }
    .summary-row { display: flex; justify-content: space-between; padding: 10px 0; font-size: 14px; border-bottom: 1px solid #e9ecef; }
    .summary-row.highlight-balance { background: #fff1f2; padding: 15px; border-radius: 6px; border: 1px solid #ffe4e6; margin-top: 10px; font-size: 16px; color: #e63946; }

    /* Footer */
    .receipt-footer {
        clear: both;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        padding-top: 50px;
        margin-top: 15px;
        border-top: 2px solid #edf2f4;
    }
    .footer-note p { font-size: 11px; color: #8d99ae; font-style: italic; margin-bottom: 5px; }
    .signature-box { text-align: center; }
    .signature-line { width: 150px; border-top: 1px solid #333; margin-bottom: 10px; }
    .signature-box p { font-size: 12px; font-weight: bold; color: #2b2d42; }
}
/* --- Premium Colorful Receipt Styles --- */
.premium-receipt {
    display: none;
    background: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

@media print {
    @page { size: A4; margin: 0; }
    body { background: #fff; margin: 0; padding: 0; }
    body * { visibility: hidden; }
    
    .sidebar, .main-content { display: none !important; }
    
    /* CRITICAL: Forces browsers to print background colors and gradients */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .premium-receipt, .premium-receipt * { visibility: visible; }
    .premium-receipt {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
    }

    .receipt-inner {
        position: relative;
        overflow: hidden;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 10px 30px rgba(0,0,0,0.05); /* Soft shadow looks great if printed to PDF */
    }

    /* Colorful Header */
    .receipt-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: linear-gradient(135deg, #0369a1, #075985);
        padding: 15px;
        color: white;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 20px;
    }

    .receipt-logo svg {
        width: 70px;
        height: 70px;
        color: #ffb703; /* Vibrant Gold Accent */
        filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    }

    .institute-details h1 { 
        font-size: 24px; 
        color: #ffffff; 
        margin-bottom: 5px; 
        text-transform: uppercase; 
        letter-spacing: 1px;
    }
    .institute-details p { 
        font-size: 12px; 
        color: #e0eaff; /* Soft blue/white */
        margin-bottom: 3px; 
    }
    
    .receipt-title-box { text-align: right; }
    .receipt-title-box h2 { 
        font-size: 26px; 
        color: aqua; 
        margin-bottom: 15px; 
        letter-spacing: 2px; 
    }
    .meta-row { font-size: 14px; margin-bottom: 5px; color: #e0eaff; }
    .meta-row span { display: inline-block; width: 80px; text-align: left; opacity: 0.8;}
    .meta-row strong { color: #ffffff; }

    /* Student Grid - Colorful Accent */
    .student-details-grid {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        gap: 20px;
        background: #f8faff;
        padding: 25px;
        margin: 30px;
        border-radius: 8px;
        border-left: 5px solid #4361ee; /* Brand color accent */
    }
    .label { font-size: 11px; text-transform: uppercase; color: #8d99ae; font-weight: bold; margin-bottom: 5px; }
    .student-details-grid h3 { font-size: 18px; color: #2b2d42; margin: 0; }
    .value { font-size: 14px; font-weight: 600; color: #2b2d42; }

    /* Table - Colorful Headers */
    .receipt-table-container { margin: 0 30px; position: relative; z-index: 2;}
    .receipt-table-container h3 { font-size: 16px; margin-bottom: 15px; color: #4361ee; border-bottom: 2px solid #edf2f4; padding-bottom: 10px;}
    .receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 30px;  }
    .receipt-table th { 
        background: #4361ee; 
        color: #fff; 
        padding: 12px; 
        text-align: left; 
        font-size: 13px; 
        font-weight: 600; 
        border-radius: 0;
        
        

        
    }
    .receipt-table td { padding: 12px; border-bottom: 1px solid #edf2f4; font-size: 14px; color: #333; }
    .align-right { text-align: right !important; }

    /* Summary Highlights */
    .financial-summary {
        width: 350px;
        float: right;
        margin: 0 30px 40px 0;
        position: relative;
        z-index: 2;
    }
    .summary-row { display: flex; justify-content: space-between; padding: 12px 15px; font-size: 14px; border-bottom: 1px solid #edf2f4; }
    
    .summary-row.highlight-paid {
        background: #e6fcf5;
        color: #0ca678;
        border-radius: 6px;
        margin-top: 5px;
        border: none;
    }
    .summary-row.highlight-balance { 
        background: #fff5f5; 
        border-left: 4px solid #e63946; 
        margin-top: 10px; 
        font-size: 16px; 
        color: #e63946; 
        border-radius: 4px;
    }

    /* Footer */
    .receipt-footer {
        clear: both;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        padding: 15px;
        margin-top: 10px;
        background: #f8f9fa;
        border-top: 1px solid #edf2f4;
        border-radius: 0 0 12px 12px;
    }
    .footer-note p { font-size: 11px; color: #8d99ae; font-style: italic; margin-bottom: 5px; }
    .signature-box { text-align: center; }
    .signature-line { width: 180px; border-top: 1px solid #2b2d42; margin-bottom: 10px; }
    .signature-box p { font-size: 12px; font-weight: bold; color: #4361ee; }

    /* Faint Watermark Logo */
    .watermark-logo img {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 400px;
        height: 400px;
        opacity: 0.05;
        z-index: 1;
        pointer-events: none;
        color: #4361ee;
    }
}

.receipt-logo img {
    width: 70px; /* Adjust this number to make it bigger or smaller */
    height: 70px;
    object-fit: contain; /* Ensures the logo doesn't stretch or warp */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* --- Analytics Tab Styles --- */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* Progress Bars */
.progress-wrapper { margin-top: 20px; }
.progress-labels { 
    display: flex; justify-content: space-between; 
    margin-bottom: 10px; font-size: 14px; font-weight: 600; 
}
.progress-track { 
    width: 100%; height: 24px; 
    background: var(--border); 
    border-radius: 12px; 
    overflow: hidden; 
    display: flex; 
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.progress-fill { 
    height: 100%; 
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); 
}
.fill-success { background: linear-gradient(90deg, #2a9d8f, #20c997); }
.fill-primary { background: linear-gradient(90deg, #4361ee, #3f37c9); }

/* Payment Modes */
.modes-container { margin-top: 15px; }
.mode-row { 
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px dashed var(--border); 
}
.mode-row:last-child { border: none; padding-bottom: 0; }
.mode-name { display: flex; align-items: center; gap: 8px; font-weight: 500;}
.mode-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Course Bar Charts */
.bar-chart-container { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.bar-row { display: flex; flex-direction: column; gap: 8px; }
.bar-labels { display: flex; justify-content: space-between; font-size: 14px; }
.bar-labels strong { color: var(--text-main); }
.bar-labels span { color: var(--text-muted); font-size: 13px; }
.bar-track { 
    width: 100%; height: 12px; background: var(--border); border-radius: 6px; overflow: hidden; 
}
/* --- Analytics Filter Buttons --- */
.analytics-filters {
    display: flex;
    gap: 8px;
    background: var(--card-bg);
    padding: 5px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.filter-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.filter-btn:hover {
    color: var(--text-main);
    background: var(--bg-color);
}
.filter-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(67, 97, 238, 0.3);
}
/* --- Dynamic Installment Form --- */
.installments-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.installment-row {
    display: flex;
    gap: 15px;
    align-items: center;
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.installment-row input { flex: 1; }
.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
.btn-danger:hover { opacity: 0.8; }
.btn-secondary {
    background: var(--border);
    color: var(--text-main);
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
.receipt-table-container { page-break-inside: avoid; } /* Prevents table splitting when printing */


/* --- Full Screen Cloud Loader --- */
.cloud-loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.5s ease;
}
.cloud-loader h2 { margin-top: 20px; color: var(--primary); }
.cloud-loader p { color: var(--text-muted); margin-top: 5px; }

/* CSS Loading Spinner */
.spinner {
    width: 50px; height: 50px;
    border: 5px solid var(--border);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Utility to hide loader */
.fade-out { opacity: 0; pointer-events: none; }

/* --- Fee Type Toggle Styles --- */
.fee-type-toggle {
    display: flex;
    gap: 25px;
    padding: 12px 15px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.fee-type-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
}
.fee-type-toggle input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}




/* --- Premium View Student Modal (Landscape Layout) --- */
.modal { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    justify-content: center; align-items: center; z-index: 1000;
}
.modal.active { display: flex; animation: fadeIn 0.2s ease-out; }

/* Expanded width for Landscape */
.premium-modal { 
    width: 1100px; 
    max-width: 100%; 
    background: transparent; 
    padding: 0; 
    border-radius: 16px; 
    overflow: hidden; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.25); 
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
}

.modal-header {
    background: linear-gradient(135deg, #0369a1, #075985);
    color: white; padding: 30px; position: relative;
}
.modal-header h2 { margin: 0; font-size: 24px; display: flex; align-items: center; gap: 12px; }
.modal-header p { margin: 8px 0 0 0; opacity: 0.85; font-size: 14px; letter-spacing: 0.5px;}

.close-btn { 
    position: absolute; top: 20px; right: 25px; 
    font-size: 28px; color: white; cursor: pointer; 
    opacity: 0.7; transition: 0.2s; z-index: 10;
}
.close-btn:hover { opacity: 1; transform: scale(1.1); }

/* Landscape Two-Column Grid */
.modal-body-content { 
    padding: 30px; 
    background: var(--bg-color); 
    max-height: 65vh; 
    overflow-y: auto; 
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: start;
}

/* Stacked Profile Cards for the Left Column */
.student-profile-grid {
    display: flex; 
    flex-direction: column;
    gap: 20px; background: var(--card-bg); padding: 25px;
    border-radius: 12px; border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.profile-item p.label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; font-weight: bold; letter-spacing: 0.5px;}
.profile-item p.value { font-size: 15px; color: var(--text-main); font-weight: 600; }

/* Modal History Table */
.modal-history-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.modal-history-table th { background: #f8f9fa; padding: 12px 15px; text-align: left; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 600;}
.modal-history-table td { padding: 14px 15px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-main);}
.modal-history-table tr:last-child td { border-bottom: none; }

[data-theme="dark"] .modal-history-table th { background: #2a2b2e; }

/* Responsive fallback for smaller screens */
@media (max-width: 900px) {
    .modal-body-content { grid-template-columns: 1fr; }
    .student-profile-grid { flex-direction: row; flex-wrap: wrap; }
}




/* ==========================================
   📱 MOBILE RESPONSIVE DESIGN (Max Width: 850px)
   ========================================== */

/* Mobile Menu Button & Overlay (Hidden on Desktop) */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    align-items: center;
    justify-content: center;
}
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-overlay.active { display: block; opacity: 1; }

@media (max-width: 850px) {
    /* Show mobile button */
    .mobile-menu-btn { display: flex; }
    
    /* Convert Sidebar to Slide-in Off-Canvas Menu */
    .sidebar {
        position: fixed;
        left: -300px; /* Hide completely off-screen */
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 15px rgba(0,0,0,0.2);
    }
    .sidebar.active { transform: translateX(300px); } /* Slide in */
    
    /* Adjust Main Content Area */
    .main-content { 
        padding: 70px 15px 20px 15px; /* Extra top padding so content isn't hidden under the hamburger button */
    }
    
    /* Stack Headers & Adjust Typography */
    header { flex-direction: column; align-items: flex-start; gap: 10px; }
    header h1 { font-size: 22px; }
    .analytics-filters { flex-wrap: wrap; width: 100%; }
    .filter-btn { flex: 1; text-align: center; font-size: 11px; padding: 8px; }
    
    /* Stack Forms into Single Columns */
    .form-grid { grid-template-columns: 1fr; }
    .fee-type-toggle { flex-direction: column; gap: 15px; }
    
    /* Adjust Modal (Popups) for Small Screens */
    .premium-modal { width: 95%; max-height: 90vh; display: flex; flex-direction: column;}
    .modal-header { padding: 20px; }
    .modal-header h2 { font-size: 18px; flex-wrap: wrap; }
    .modal-body-content { 
        grid-template-columns: 1fr; /* Force single column on mobile */
        padding: 15px;
        gap: 15px;
    }
    .close-btn { top: 15px; right: 15px; font-size: 24px; }
    
    /* Ensure Tables are horizontally swipeable */
    .table-responsive { 
        width: 100%; 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        box-shadow: inset -10px 0 10px -10px rgba(0,0,0,0.1); /* Hint that there is more content to the right */
    }
}


/* Change grid-template-columns to fit the new Duration column */
    .student-details-grid {
        display: grid;
        grid-template-columns: 2fr 1fr 1.5fr 1fr; /* 4 Columns now */
        gap: 20px;
        background: #f8faff;
        padding: 25px;
        margin: 30px;
        border-radius: 8px;
        border-left: 5px solid #4361ee; 
    }




    /* Adjust grid to fit 5 columns neatly */
    .student-details-grid {
        display: grid;
        grid-template-columns: 1.5fr 1fr 1.5fr 1fr 1fr; /* 5 Columns */
        gap: 15px;
        background: #f8faff;
        padding: 20px 25px;
        margin: 30px;
        border-radius: 8px;
        border-left: 5px solid #4361ee; 
    }



    



