@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* --- CUSTOM VARIABLES --- */
:root {
    --font-primary: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
    
    /* Elegant Premium Light Palette */
    --bg-main: #ffffff;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.98);
    --border-glass: rgba(15, 23, 42, 0.08);
    --border-glass-focus: rgba(99, 102, 241, 0.5);
    
    /* Premium Accent Colors */
    --accent-indigo: #4f46e5;
    --accent-violet: #7c3aed;
    --accent-emerald: #10b981;
    --accent-emerald-opaque: rgba(16, 185, 129, 0.1);
    --accent-rose: #f43f5e;
    --accent-rose-opaque: rgba(244, 63, 94, 0.1);
    --accent-amber: #d97706;
    --accent-amber-opaque: rgba(217, 119, 6, 0.1);
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    /* UI Sizing & Transitions */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 4px 20px -2px rgba(15, 23, 42, 0.08), 0 2px 15px -3px rgba(15, 23, 42, 0.04);
    --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.12);
    
    /* Sidebar Specific Variables (always dark for high-contrast premium layout) */
    --sidebar-bg: rgba(10, 16, 30, 0.95);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
}

/* --- RESET & GLOBAL STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-main);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
}

button, input, select, textarea {
    font-family: inherit;
    color: inherit;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.02);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.25);
    border-radius: var(--radius-full);
    border: 3px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-indigo);
    border: 2px solid transparent;
}

/* --- APP LAYOUT --- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-full);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.55);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 10px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-violet) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(to right, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow-y: visible;
    padding-right: 4px;
    margin-bottom: 20px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 18px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-item a:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover-bg);
    border-color: var(--sidebar-border);
    transform: translateX(4px);
}

.nav-item.active > a {
    color: white;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-glow);
}

.nav-item a svg {
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
}

.nav-item.active > a svg {
    color: var(--accent-indigo);
    filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.5));
}

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--sidebar-text-active);
    border: 1px solid var(--sidebar-border);
}

.user-info .user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--sidebar-text-active);
}

.user-info .user-role {
    font-size: 0.75rem;
    color: var(--sidebar-text);
}

/* Main Viewport */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

.header {
    height: 80px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 10;
    color: var(--text-primary);
}

.page-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.academic-year-badge {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--accent-indigo);
    color: #a5b4fc;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Page Containers */
.view-container {
    padding: 40px 40px 80vh 40px; /* Extended bottom padding to allow scrolling forms fully into view */
    display: none;
    flex-direction: column;
    gap: 30px;
    animation: fadeIn 0.4s ease-out;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.view-container.active {
    display: flex;
}

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

/* --- DASHBOARD ELEMENTS --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-indigo);
    opacity: 0;
    transition: var(--transition-smooth);
}

.kpi-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-card.revenue {
    background: rgba(236, 253, 245, 0.95);
    border-color: rgba(16, 185, 129, 0.25);
}
.kpi-card.revenue:hover {
    background: rgba(209, 250, 229, 0.95);
    border-color: rgba(16, 185, 129, 0.4);
}
.kpi-card.revenue::before { background: var(--accent-emerald); }

.kpi-card.expense {
    background: rgba(255, 241, 242, 0.95);
    border-color: rgba(244, 63, 94, 0.25);
}
.kpi-card.expense:hover {
    background: rgba(254, 226, 226, 0.95);
    border-color: rgba(244, 63, 94, 0.4);
}
.kpi-card.expense::before { background: var(--accent-rose); }

.kpi-card.cashflow {
    background: rgba(240, 249, 255, 0.95);
    border-color: rgba(14, 165, 233, 0.25);
}
.kpi-card.cashflow:hover {
    background: rgba(224, 242, 254, 0.95);
    border-color: rgba(14, 165, 233, 0.4);
}
.kpi-card.cashflow::before { background: #0ea5e9; }

.kpi-card.arrears {
    background: rgba(255, 247, 237, 0.95);
    border-color: rgba(249, 115, 22, 0.25);
}
.kpi-card.arrears:hover {
    background: rgba(255, 237, 213, 0.95);
    border-color: rgba(249, 115, 22, 0.4);
}
.kpi-card.arrears::before { background: #f97316; }

.kpi-info .kpi-label {
    font-size: 0.85rem;
    color: #475569 !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    font-weight: 600;
}

.kpi-info .kpi-val {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a !important;
}

.kpi-icon-container {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-card.revenue .kpi-icon-container { background: rgba(16, 185, 129, 0.12); color: #059669; }
.kpi-card.expense .kpi-icon-container { background: rgba(244, 63, 94, 0.12); color: #e11d48; }
.kpi-card.cashflow .kpi-icon-container { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.kpi-card.arrears .kpi-icon-container { background: rgba(249, 115, 22, 0.12); color: #ea580c; }

/* Chart and Activity Section */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-premium);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
}

.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

.activity-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    max-height: 380px;
    padding-right: 5px;
}

.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.act-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.act-badge {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

.act-badge.income { background: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald); }
.act-badge.expense { background: var(--accent-rose); box-shadow: 0 0 8px var(--accent-rose); }

.act-details .act-desc {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.act-details .act-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.act-right {
    text-align: right;
}

.act-amount {
    font-size: 0.92rem;
    font-weight: 700;
}

.act-amount.income { color: var(--accent-emerald); }
.act-amount.expense { color: var(--accent-rose); }

.act-method {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Secondary Dashboard Grid */
.dashboard-sub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 900px) {
    .dashboard-sub-grid {
        grid-template-columns: 1fr;
    }
}

/* --- BUTTONS --- */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-violet) 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-action:hover {
    color: var(--text-primary);
    background: var(--accent-indigo);
    border-color: var(--accent-indigo);
    transform: scale(1.08);
}

/* Edit action styling */
.btn-action.edit,
.btn-action.edit-student-btn,
.btn-action.edit-staff-btn,
.btn-action.edit-invoice-btn,
.btn-action.edit-class-btn,
.btn-action.edit-category-btn,
.btn-action.edit-item-btn,
.btn-action.edit-purchase-btn,
.btn-action.edit-vehicle-btn,
.btn-action.edit-route-btn,
.btn-action.edit-notice-btn {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.2);
}
.btn-action.edit:hover,
.btn-action.edit-student-btn:hover,
.btn-action.edit-staff-btn:hover,
.btn-action.edit-invoice-btn:hover,
.btn-action.edit-class-btn:hover,
.btn-action.edit-category-btn:hover,
.btn-action.edit-item-btn:hover,
.btn-action.edit-purchase-btn:hover,
.btn-action.edit-vehicle-btn:hover,
.btn-action.edit-route-btn:hover,
.btn-action.edit-notice-btn:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    transform: scale(1.08);
}

/* Delete action styling */
.btn-action.delete {
    background: rgba(244, 63, 94, 0.08);
    color: #f43f5e;
    border-color: rgba(244, 63, 94, 0.2);
}
.btn-action.delete:hover {
    background: #f43f5e;
    color: #ffffff;
    border-color: #f43f5e;
    transform: scale(1.08);
}

/* Collect action styling */
.btn-action.pay,
.btn-action.collect-payment-btn {
    background: rgba(16, 185, 129, 0.08);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
}
.btn-action.pay:hover,
.btn-action.collect-payment-btn:hover {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
    transform: scale(1.08);
}

.btn-collect-text {
    background: var(--accent-emerald);
    color: #ffffff !important;
    border: 1px solid var(--accent-emerald);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-collect-text:hover {
    background: #059669;
    border-color: #059669;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-collect-text:active {
    transform: translateY(0);
}


/* Print action styling */
.btn-action.print-student-btn {
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
    border-color: rgba(99, 102, 241, 0.2);
}
.btn-action.print-student-btn:hover {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
    transform: scale(1.08);
}

/* --- DATA CONTROLS & TABLES --- */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    flex-wrap: wrap;
}

.filters-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper input {
    background: #ffffff;
    border: 1px solid var(--border-glass);
    padding: 10px 16px 10px 38px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    width: 240px;
    transition: var(--transition-smooth);
}

.search-input-wrapper input:focus {
    border-color: var(--accent-indigo);
    outline: none;
    box-shadow: var(--shadow-glow);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.filter-select {
    background: #ffffff;
    border: 1px solid var(--border-glass);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition-smooth);
}

.filter-select:focus {
    border-color: var(--accent-indigo);
    box-shadow: var(--shadow-glow);
}

.filter-select option {
    background: #ffffff;
    color: var(--text-primary);
}

.table-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    width: 100%;
    min-width: 0;
}

.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
}

.custom-table th {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-glass);
    padding: 18px 24px;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.custom-table td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-glass);
    vertical-align: middle;
}

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

.custom-table tbody tr:hover {
    background: rgba(15, 23, 42, 0.015);
}

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

/* Table Text Formats */
.table-primary-text {
    font-weight: 600;
    color: var(--text-primary);
}

.table-secondary-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.table-currency {
    font-family: var(--font-display);
    font-weight: 700;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.paid, .badge.active {
    background: var(--accent-emerald-opaque);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.unpaid, .badge.inactive {
    background: var(--accent-rose-opaque);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge.partially_paid {
    background: var(--accent-amber-opaque);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.role-teacher { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge.role-admin { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge.role-support { background: rgba(100, 116, 139, 0.15); color: #cbd5e1; border: 1px solid rgba(100, 116, 139, 0.3); }

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-box {
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-box > form {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    min-height: 0;
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-header {
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-smooth);
}

.btn-close-modal:hover {
    color: var(--accent-rose);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex-grow: 1;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-glass);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent-indigo);
    box-shadow: var(--shadow-glow);
}

.form-textarea {
    resize: vertical;
    height: 90px;
}

.form-checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    margin-top: 8px;
}

.form-checkbox-group input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-indigo);
    cursor: pointer;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* --- REPORTS CUSTOM PAGES --- */
.report-date-selector {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 24px;
}

.report-summary-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .report-summary-boxes {
        grid-template-columns: 1fr;
    }
}

.report-sum-box {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    text-align: center;
}

.report-sum-box .sum-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}

.report-sum-box .sum-val {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
}

.report-sum-box.income .sum-val { color: var(--accent-emerald); }
.report-sum-box.expense .sum-val { color: var(--accent-rose); }
.report-sum-box.profit .sum-val { color: var(--accent-indigo); }

.report-tables-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 900px) {
    .report-tables-split {
        grid-template-columns: 1fr;
    }
}

/* Custom styles for tables in splits */
.report-tables-split .table-card {
    height: 100%;
}

.card-description {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-glass);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.toast.success::before { background: var(--accent-emerald); }
.toast.error::before { background: var(--accent-rose); }
.toast.info::before { background: var(--accent-indigo); }

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-message {
    font-size: 0.88rem;
    font-weight: 500;
}

/* Multi-column grid-based forms inside modals */
.modal-box.modal-large {
    max-width: 850px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-box.modal-large .modal-body {
    overflow-y: auto;
    flex-grow: 1;
    padding: 24px 24px 100px 24px; /* Extra bottom padding for form visibility */
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.form-section-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-indigo);
    margin: 20px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-glass);
    grid-column: 1 / -1;
}

/* For checklists */
.form-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 8px;
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .form-grid-2, .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Dropdown Menu styles */
.nav-item.has-dropdown {
    position: relative;
    display: flex;
    flex-direction: column;
}
.nav-item.has-dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.nav-item.has-dropdown .dropdown-toggle .chevron {
    width: 16px;
    height: 16px;
    color: var(--sidebar-text);
    opacity: 0.8;
    transition: transform var(--transition-smooth), opacity var(--transition-smooth), color var(--transition-smooth);
}
.nav-item.has-dropdown:hover .dropdown-toggle .chevron {
    opacity: 1;
    color: var(--sidebar-text-active);
}
.nav-item.has-dropdown.open .dropdown-toggle .chevron {
    transform: rotate(180deg);
    opacity: 1;
    color: var(--sidebar-text-active);
}
.nav-item.has-dropdown .dropdown-menu {
    list-style: none;
    padding-left: 20px;
    margin-top: 4px;
    display: none;
    flex-direction: column;
    gap: 4px;
}
.nav-item.has-dropdown.open .dropdown-menu {
    display: flex;
}
.nav-item.has-dropdown .dropdown-menu li a {
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-item.has-dropdown .dropdown-menu li a:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover-bg);
    transform: translateX(4px);
}
.nav-item.has-dropdown .dropdown-menu li.active a {
    color: white;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-md);
}

/* Attendance Expandable Accordion styles */
.attendance-class-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-smooth);
}
.attendance-class-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}
.attendance-class-header {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}
.attendance-class-header:hover {
    background: rgba(255, 255, 255, 0.05);
}
.attendance-class-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}
.attendance-class-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.attendance-class-chevron {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: transform var(--transition-smooth);
}
.attendance-class-card.expanded .attendance-class-chevron {
    transform: rotate(180deg);
}
.attendance-class-body {
    display: none;
    padding: 24px;
    border-top: 1px solid var(--border-glass);
}
.attendance-class-card.expanded .attendance-class-body {
    display: block;
}

/* Radio buttons alignment for attendance & marksheets */
.attendance-radio-group {
    display: flex;
    gap: 15px;
    align-items: center;
}
.attendance-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-secondary);
}
.attendance-radio-label input[type="radio"] {
    cursor: pointer;
    accent-color: var(--accent-indigo);
}

/* Header Academic Year dropdown custom hover states */
.header-ay-dropdown {
    background: rgba(15, 23, 42, 0.04) !important;
    border: 1px solid var(--border-glass) !important;
    color: var(--text-primary) !important;
    transition: all var(--transition-smooth) !important;
}
.header-ay-dropdown:hover, .header-ay-dropdown:focus {
    background: rgba(15, 23, 42, 0.08) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}
.header-ay-dropdown option {
    background-color: #ffffff;
    color: var(--text-primary);
}

/* Autocomplete search results dropdown */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-xl);
    margin-top: 6px;
    scrollbar-width: thin;
}
.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-glass);
    transition: all var(--transition-fast);
}
.search-result-item:hover {
    background: var(--bg-card-hover);
    padding-left: 20px;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}
.search-result-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 3px;
}
.selected-student-pill {
    padding: 12px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-md);
    font-weight: 500;
    height: 46px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--text-secondary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.05);
}

/* Drag and Drop Upload Area Styles */
.upload-drag-area:hover, .upload-drag-area.dragover {
    border-color: var(--accent-indigo) !important;
    background: rgba(99, 102, 241, 0.05) !important;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

/* Compact padding for grade enrollment table inside modal with Side menu (blue) background and white text */
#grade-enrollment-table {
    background: var(--sidebar-bg) !important;
    color: #ffffff !important;
    border-collapse: collapse;
}

#grade-enrollment-table thead tr {
    background: rgba(255, 255, 255, 0.08) !important;
}

#grade-enrollment-table th {
    padding: 10px 18px !important;
    font-size: 0.88rem;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
}

#grade-enrollment-table td {
    padding: 10px 18px !important;
    font-size: 0.88rem;
    color: #e2e8f0 !important; /* light slate text */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#grade-enrollment-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

#grade-enrollment-table tfoot tr {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border-top: 2px solid rgba(255, 255, 255, 0.2) !important;
}

#grade-enrollment-table th:nth-child(6),
#grade-enrollment-table td:nth-child(6),
#grade-enrollment-table tfoot td:nth-child(6) {
    border-left: 2px solid rgba(255, 255, 255, 0.2) !important;
}

/* Modal styling overrides to make the total card one unified color */
#modalGradeEnrollmentDetails .modal-box {
    background: var(--sidebar-bg) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

#modalGradeEnrollmentDetails .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

#modalGradeEnrollmentDetails .modal-title {
    color: #ffffff !important;
}

#modalGradeEnrollmentDetails .btn-close-modal {
    color: rgba(255, 255, 255, 0.6) !important;
}

#modalGradeEnrollmentDetails .btn-close-modal:hover {
    color: #ffffff !important;
}

#modalGradeEnrollmentDetails .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: rgba(255, 255, 255, 0.03) !important;
}

#modalGradeEnrollmentDetails .modal-footer .btn-secondary {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

#modalGradeEnrollmentDetails .modal-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Custom colored cards for Voucher views */
.card-voucher-payment {
    background: rgba(255, 241, 242, 0.85) !important;
    border: 1px solid rgba(244, 63, 94, 0.25) !important;
}
.card-voucher-payment:hover {
    background: rgba(255, 228, 230, 0.95) !important;
    border-color: rgba(244, 63, 94, 0.4) !important;
}

.card-voucher-receipt {
    background: rgba(236, 253, 245, 0.85) !important;
    border: 1px solid rgba(16, 185, 129, 0.25) !important;
}
.card-voucher-receipt:hover {
    background: rgba(209, 250, 229, 0.95) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

.card-voucher-contra {
    background: rgba(240, 249, 255, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
}
.card-voucher-contra:hover {
    background: rgba(224, 242, 254, 0.95) !important;
    border-color: rgba(14, 165, 233, 0.4) !important;
}

.card-voucher-journal {
    background: rgba(240, 249, 255, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
}
.card-voucher-journal:hover {
    background: rgba(224, 242, 254, 0.95) !important;
    border-color: rgba(14, 165, 233, 0.4) !important;
}

/* Color styles for specific action buttons prior to hover */
.btn-action.edit {
    background: rgba(79, 70, 229, 0.08) !important;
    color: var(--accent-indigo) !important;
    border-color: rgba(79, 70, 229, 0.2) !important;
}
.btn-action.edit:hover {
    color: var(--text-primary) !important;
    background: var(--accent-indigo) !important;
    border-color: var(--accent-indigo) !important;
}

.btn-action.delete {
    background: rgba(244, 63, 94, 0.08) !important;
    color: var(--accent-rose) !important;
    border-color: rgba(244, 63, 94, 0.2) !important;
}
.btn-action.delete:hover {
    color: var(--text-primary) !important;
    background: var(--accent-rose) !important;
    border-color: var(--accent-rose) !important;
}

.btn-action.pay {
    background: rgba(16, 185, 129, 0.08) !important;
    color: var(--accent-emerald) !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
}
.btn-action.pay:hover {
    color: var(--text-primary) !important;
    background: var(--accent-emerald) !important;
    border-color: var(--accent-emerald) !important;
}

/* --- STUDENT QUICK SEARCH COMPONENT --- */
.student-search-container {
    position: relative;
    width: 100%;
}
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-glass-focus);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-premium);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 8px;
    display: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-glass);
    transition: var(--transition-smooth);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.autocomplete-item:last-child {
    border-bottom: none;
}
.autocomplete-item:hover {
    background: rgba(99, 102, 241, 0.08);
}
.autocomplete-item .student-name {
    font-weight: 600;
    color: var(--text-primary);
}
.autocomplete-item .student-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Modal Search Detail Layout */
.search-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 20px;
    gap: 15px;
}
.search-tab-btn {
    padding: 10px 18px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.search-tab-btn:hover {
    color: var(--accent-indigo);
}
.search-tab-btn.active {
    color: var(--accent-indigo);
    border-bottom-color: var(--accent-indigo);
}
.search-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}
.search-tab-content.active {
    display: block;
}

.profile-details-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 24px;
    align-items: start;
    margin-top: 10px;
}
@media (max-width: 600px) {
    .profile-details-grid {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
}
.search-student-photo {
    width: 130px;
    height: 130px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid var(--border-glass);
    background: #f1f5f9;
}
.search-student-avatar {
    width: 130px;
    height: 130px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-violet) 100%);
    box-shadow: var(--shadow-glow);
}
.search-info-card {
    background: rgba(15, 23, 42, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.search-info-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px;
    border-bottom: 1px dashed var(--border-glass);
    padding-bottom: 8px;
}
.search-info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.search-info-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.search-info-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Header action search icon hover details */
#btn-header-student-search:hover {
    background: rgba(99, 102, 241, 0.1) !important;
    border-color: var(--accent-indigo) !important;
    color: var(--accent-indigo) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Search results detail card styles */
#student-search-details-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-premium);
    margin-top: 20px;
    animation: fadeIn 0.4s ease-out;
}

