/* ============================================================
   SOHAN LAL DAV PUBLIC SCHOOL — Fee Portal Design System
   Enterprise Light Theme v3.0
   Inspired by Zoho, Razorpay, Freshworks, MS365
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&family=Poppins:wght@400;500;600;700;800&display=swap');

/* ════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES — LIGHT ENTERPRISE THEME
   ════════════════════════════════════════════════════ */
:root {
    /* ── App Background ── */
    --bg-app:       #F0F4F8;
    --bg-page:      #F8FAFC;
    --bg-card:      #FFFFFF;
    --bg-card-hover:#F8FAFC;
    --bg-sidebar:   #FFFFFF;
    --bg-topbar:    #FFFFFF;
    --bg-input:     #FFFFFF;
    --bg-input-focus:#EFF6FF;
    --bg-secondary: #F1F5F9;
    --bg-stripe:    #F8FAFC;

    /* ── Brand Colors ── */
    --primary:          #2563EB;
    --primary-dark:     #1D4ED8;
    --primary-light:    #EFF6FF;
    --primary-mid:      #BFDBFE;
    --indigo:           #4F46E5;
    --indigo-light:     #EEF2FF;

    /* ── Status / Semantic ── */
    --success:          #10B981;
    --success-dark:     #059669;
    --success-light:    #D1FAE5;
    --success-bg:       #ECFDF5;
    --warning:          #F59E0B;
    --warning-dark:     #D97706;
    --warning-light:    #FEF3C7;
    --warning-bg:       #FFFBEB;
    --danger:           #EF4444;
    --danger-dark:      #DC2626;
    --danger-light:     #FEE2E2;
    --danger-bg:        #FEF2F2;
    --info:             #0EA5E9;
    --info-dark:        #0284C7;
    --info-light:       #E0F2FE;
    --info-bg:          #F0F9FF;
    --orange:           #F97316;
    --orange-light:     #FFF7ED;
    --amber:            #F59E0B;
    --amber-light:      #FFFBEB;

    /* ── Neutral / Text ── */
    --text-primary:     #0F172A;
    --text-secondary:   #374151;
    --text-muted:       #6B7280;
    --text-light:       #9CA3AF;
    --text-white:       #FFFFFF;
    --text-brand:       #2563EB;

    /* ── Borders ── */
    --border:           #E5E7EB;
    --border-light:     #F3F4F6;
    --border-medium:    #D1D5DB;
    --border-focus:     #2563EB;
    --border-hover:     #93C5FD;

    /* ── Sidebar ── */
    --sidebar-width:    260px;
    --topbar-height:    64px;

    /* ── Shadows — Refined for light bg ── */
    --shadow-xs:    0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:    0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg:    0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl:    0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
    --shadow-blue:  0 4px 14px rgba(37,99,235,0.25);
    --shadow-card:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);

    /* ── Border Radius ── */
    --radius-xs:    4px;
    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    14px;
    --radius-xl:    20px;
    --radius-full:  9999px;

    /* ── Transitions ── */
    --transition:       all 0.18s cubic-bezier(0.4,0,0.2,1);
    --transition-slow:  all 0.3s cubic-bezier(0.4,0,0.2,1);
    --transition-spring:all 0.25s cubic-bezier(0.34,1.56,0.64,1);

    /* ── Typography ── */
    --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Poppins', var(--font-sans);
}

/* ════════════════════════════════════════════════════
   RESET & BASE
   ════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg-app);
    color: var(--text-primary);
    font-size: 14.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
/* ════════════════════════════════════════════════════
   BACKWARD-COMPATIBILITY ALIASES
   Maps old dark-theme vars → new light-theme values
   so every existing module file works without edits.
   ════════════════════════════════════════════════════ */
:root {
    /* Old accent-* vars → Royal Blue system */
    --accent-1:         #2563EB;
    --accent-2:         #2563EB;
    --accent-3:         #0EA5E9;
    --accent-grad:      linear-gradient(135deg, #2563EB 0%, #4F46E5 100%);
    --accent-grad-2:    linear-gradient(135deg, #0EA5E9 0%, #2563EB 100%);
    --text-accent:      #2563EB;

    /* Old bg-primary → light app bg */
    --bg-primary:       #F8FAFC;
}


::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--border-light); }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════ */
.login-body {
    background: linear-gradient(135deg, #EFF6FF 0%, #F0F4FF 40%, #F8FAFC 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: var(--radius-full);
    filter: blur(80px);
    animation: orbFloat 10s ease-in-out infinite;
}
.orb-1 { width:500px;height:500px; background:radial-gradient(circle,rgba(37,99,235,.12),transparent); top:-150px;left:-150px; }
.orb-2 { width:400px;height:400px; background:radial-gradient(circle,rgba(79,70,229,.1),transparent); bottom:-100px;right:-100px; animation-delay:4s; }
.orb-3 { width:300px;height:300px; background:radial-gradient(circle,rgba(14,165,233,.08),transparent); top:50%;left:50%;transform:translate(-50%,-50%); animation-delay:7s; }

@keyframes orbFloat {
    0%,100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-25px) scale(1.03); }
}

.login-card {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 48px 44px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    border: 1px solid var(--border);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--indigo));
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    box-shadow: var(--shadow-blue);
}

.login-school-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
}

.login-tagline {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: .3px;
}

.login-section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-section-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-light);
    color: var(--danger-dark);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-footer-text {
    text-align: center;
    font-size: 12.5px;
    color: var(--text-light);
    margin-top: 24px;
}

/* ════════════════════════════════════════════════════
   LAYOUT — SIDEBAR + MAIN WRAPPER
   ════════════════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.3);
    z-index: 200;
    backdrop-filter: blur(2px);
}

.sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 210;
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.28s cubic-bezier(0.4,0,0.2,1);
}

/* ════════════════════════════════════════════════════
   SIDEBAR HEADER — Logo + School Name
   ════════════════════════════════════════════════════ */
.sidebar-header {
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--indigo) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
    color: #fff;
}

.logo-text { min-width: 0; }

.logo-name {
    display: block;
    font-family: var(--font-display);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-sub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.sidebar-close:hover { background: var(--bg-secondary); color: var(--text-primary); }

/* ── Session Badge ── */
.session-badge {
    margin: 12px 16px 0;
    padding: 9px 12px;
    background: var(--primary-light);
    border: 1px solid var(--primary-mid);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--primary-dark);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
}

/* ════════════════════════════════════════════════════
   SIDEBAR NAV
   ════════════════════════════════════════════════════ */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-section-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    padding: 14px 10px 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active svg { color: var(--primary); }

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.75;
    transition: var(--transition);
}

.nav-item:hover svg,
.nav-item.active svg { opacity: 1; }

/* Active left-border accent */
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

/* ── Nav Group (collapsible) ── */
.nav-group {
    margin-bottom: 2px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.nav-group-header:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-group.open .nav-group-header {
    color: var(--text-primary);
}

.nav-group-arrow {
    transition: transform 0.22s ease;
    opacity: 0.5;
    flex-shrink: 0;
}

.nav-group.open .nav-group-arrow {
    transform: rotate(180deg);
    opacity: 0.8;
}

.nav-group-items {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    padding-left: 10px;
}

.nav-group.open .nav-group-items {
    max-height: 400px;
}

/* Sub nav items */
.nav-item.nav-sub {
    font-size: 13px;
    padding: 8px 10px 8px 14px;
    border-radius: var(--radius-md);
}

.nav-item.nav-sub.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* Remove the left-bar from standalone items in groups — group header serves as parent indicator */
.nav-item.nav-sub.active::before {
    height: 50%;
}


/* ── Sidebar Footer (user) ── */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.collector-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.collector-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--indigo) 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.collector-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.collector-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collector-role {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: var(--transition);
    flex-shrink: 0;
}
.logout-btn:hover {
    background: var(--danger-bg);
    border-color: var(--danger-light);
    color: var(--danger);
}

/* ════════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════════ */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.menu-toggle:hover { background: var(--bg-secondary); color: var(--text-primary); }

.topbar-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.topbar-title h1 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.topbar-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.topbar-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 7px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

/* ════════════════════════════════════════════════════
   FLASH MESSAGES / TOASTS
   ════════════════════════════════════════════════════ */
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    margin: 16px 24px 0;
    border: 1px solid transparent;
    animation: slideDown 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

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

.flash-success {
    background: var(--success-bg);
    border-color: #A7F3D0;
    color: var(--success-dark);
}
.flash-error {
    background: var(--danger-bg);
    border-color: var(--danger-light);
    color: var(--danger-dark);
}
.flash-warning {
    background: var(--warning-bg);
    border-color: var(--warning-light);
    color: var(--warning-dark);
}

.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}
.flash-close:hover { opacity: 1; background: rgba(0,0,0,0.08); }

/* ════════════════════════════════════════════════════
   PAGE CONTENT
   ════════════════════════════════════════════════════ */
.page-content {
    flex: 1;
    padding: 24px;
    max-width: 1600px;
    width: 100%;
}

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header-left {}

.page-header h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-header p {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-title svg { color: var(--primary); opacity: 0.8; }

.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-stripe);
}

/* ── Grid Layouts ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.mb-24 { margin-bottom: 24px; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-8  { margin-top: 8px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ════════════════════════════════════════════════════
   STAT CARDS — KPI Cards
   ════════════════════════════════════════════════════ */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

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

.stat-card.purple::before { background: linear-gradient(90deg, #8B5CF6, #6D28D9); }
.stat-card.blue::before   { background: linear-gradient(90deg, var(--primary), var(--indigo)); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--success), #059669); }
.stat-card.amber::before  { background: linear-gradient(90deg, var(--amber), var(--orange)); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--orange), #DC2626); }
.stat-card.info::before   { background: linear-gradient(90deg, var(--info), var(--primary)); }

.stat-icon {
    width: 50px; height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.purple { background: #EDE9FE; color: #7C3AED; }
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-bg); color: var(--success-dark); }
.stat-icon.amber  { background: var(--warning-bg); color: var(--warning-dark); }
.stat-icon.orange { background: var(--orange-light); color: #C2410C; }
.stat-icon.info   { background: var(--info-bg); color: var(--info-dark); }

.stat-info { flex: 1; min-width: 0; }

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
    font-weight: 500;
}

/* ════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════ */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; }

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14.5px;
    padding: 11px 14px;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    min-height: 46px;
    line-height: 1.5;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-hover);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-light); }

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

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

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.required-star { color: var(--danger); margin-left: 2px; }

.text-warning { color: var(--warning-dark); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success-dark); }

/* ── Radio Cards ── */
.radio-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.radio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-input);
    font-size: 13.5px;
}

.radio-card:hover { border-color: var(--border-hover); background: var(--primary-light); }

.radio-card.selected,
.radio-card:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.radio-card input[type="radio"] { accent-color: var(--primary); }

.input-icon-wrap { position: relative; }
.input-icon-wrap .form-input { padding-left: 36px; }
.input-icon-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); }

/* ════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    min-height: 40px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.1px;
}

.btn:active { transform: scale(0.97); }

/* Primary */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(37,99,235,0.3);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
    box-shadow: var(--shadow-blue);
    transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border-medium);
}
.btn-secondary:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* Success */
.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover {
    background: var(--success-dark);
    border-color: var(--success-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}

/* Danger */
.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger-dark);
    border-color: var(--danger-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239,68,68,0.35);
}

/* Warning */
.btn-warning {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
}
.btn-warning:hover {
    background: var(--warning-dark);
    border-color: var(--warning-dark);
    color: #fff;
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border);
}

/* Sizes */
.btn-sm  { padding: 7px 14px; font-size: 12.5px; min-height: 34px; }
.btn-lg  { padding: 13px 28px; font-size: 15px; min-height: 48px; }
.btn-icon { padding: 8px; min-height: auto; }
.btn-block { width: 100%; }

/* ════════════════════════════════════════════════════
   BADGES / STATUS CHIPS
   ════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-light);   color: var(--primary-dark); }
.badge-purple  { background: #EDE9FE;                color: #6D28D9; }
.badge-success { background: var(--success-light);   color: var(--success-dark); }
.badge-warning { background: var(--warning-light);   color: var(--warning-dark); }
.badge-danger  { background: var(--danger-light);    color: var(--danger-dark); }
.badge-info    { background: var(--info-light);      color: var(--info-dark); }
.badge-muted   { background: var(--bg-secondary);    color: var(--text-muted); border: 1px solid var(--border); }
.badge-orange  { background: var(--orange-light);    color: #C2410C; }
.badge-amber   { background: var(--amber-light);     color: #92400E; }

/* ════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

th {
    background: var(--bg-stripe);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    transition: background 0.12s;
}

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

tbody tr:hover td { background: #F8FBFF; }

/* ════════════════════════════════════════════════════
   SEARCH BAR
   ════════════════════════════════════════════════════ */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar svg {
    position: absolute;
    left: 12px;
    color: var(--text-light);
    pointer-events: none;
}

.search-bar .form-input { padding-left: 38px; }

/* ════════════════════════════════════════════════════
   EMPTY STATES
   ════════════════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.empty-state svg { color: var(--text-light); margin-bottom: 16px; opacity: 0.5; }

.empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13.5px;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.6;
}

/* ════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════ */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.4);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.modal-backdrop.open { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalPop 0.25s cubic-bezier(0.34,1.56,0.64,1);
    border: 1px solid var(--border);
}

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

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

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    width: 32px; height: 32px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg-secondary); color: var(--text-primary); }

.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ════════════════════════════════════════════════════
   PROFILE HERO
   ════════════════════════════════════════════════════ */
.profile-hero {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.profile-avatar-large {
    width: 72px; height: 72px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, var(--indigo) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow: var(--shadow-blue);
}

.profile-info h2 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 10px;
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}
.profile-meta-item svg { color: var(--primary); opacity: 0.7; }

/* ════════════════════════════════════════════════════
   SECTION / PROGRESS BARS
   ════════════════════════════════════════════════════ */
.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary) 0%, var(--indigo) 100%);
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.progress-fill.green  { background: linear-gradient(90deg, var(--success), #059669); }
.progress-fill.amber  { background: linear-gradient(90deg, var(--amber), var(--orange)); }
.progress-fill.danger { background: linear-gradient(90deg, var(--danger), var(--danger-dark)); }

/* ════════════════════════════════════════════════════
   FEE STRUCTURE / ACCORDION
   ════════════════════════════════════════════════════ */
.fee-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}
.fee-row:last-child { border-bottom: none; }
.fee-row .fee-name { color: var(--text-secondary); font-weight: 500; }
.fee-row .fee-amount { font-weight: 700; color: var(--text-primary); }
.fee-row.waived { opacity: 0.5; text-decoration: line-through; }
.fee-row.total { border-top: 2px solid var(--border); border-bottom: none; padding-top: 14px; margin-top: 4px; }
.fee-row.total .fee-name { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.fee-row.total .fee-amount { font-size: 18px; color: var(--primary); }

/* ════════════════════════════════════════════════════
   QUICK ACTION CARDS
   ════════════════════════════════════════════════════ */
.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-spring);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: var(--shadow-card);
    text-align: center;
}

.quick-action:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-blue);
}

.quick-action .icon-wrap {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.quick-action:hover .icon-wrap {
    background: var(--primary);
    color: #fff;
}

/* ════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════ */
.fade-in {
    animation: fadeIn 0.4s ease-out both;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out both;
}

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

/* ════════════════════════════════════════════════════
   SUMMARY / HIGHLIGHT BOXES
   ════════════════════════════════════════════════════ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { background: var(--success-bg); border-color: #A7F3D0; color: var(--success-dark); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-light); color: var(--warning-dark); }
.alert-danger  { background: var(--danger-bg); border-color: var(--danger-light); color: var(--danger-dark); }
.alert-info    { background: var(--info-bg); border-color: var(--info-light); color: var(--info-dark); }

/* ════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .sidebar-overlay.visible { display: block; }
    .sidebar-close { display: flex; }
    .main-wrapper { margin-left: 0; }
    .menu-toggle { display: flex; }

    .page-content { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .grid-3 { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .topbar-date { display: none; }
    .profile-hero { flex-direction: column; }
    .quick-action-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .radio-group { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: stretch; }
}

/* ════════════════════════════════════════════════════
   SETTINGS / MISC
   ════════════════════════════════════════════════════ */
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.section-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Tag / Pill for filters */
.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--primary-mid);
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-secondary) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Divider */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* App JS openModal / closeModal helpers */
.modal-backdrop.open { display: flex; }
/* Fee Preview Item Styles */
.fee-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.fee-item.waived { opacity: 0.45; text-decoration: line-through; }
.fee-item-name { color: var(--text-secondary); flex: 1; }
.fee-item-amount { font-weight: 600; color: var(--text-primary); flex-shrink: 0; margin-left: 8px; }
.fee-total-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: linear-gradient(135deg, rgba(37,99,235,.06), rgba(79,70,229,.06)); border-top: 2px solid var(--accent-2); }
.fee-total-label { font-weight: 700; color: var(--text-primary); }
.fee-total-amount { font-size: 18px; font-weight: 800; color: var(--accent-2); }

/* --- EXPANDED RESPONSIVE OVERRIDES --- */
@media (max-width: 1024px) {
    .collect-wrapper { grid-template-columns: 1fr; }
    .collect-right { position: static; }
}
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
    .form-row { grid-template-columns: 1fr !important; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-header-actions { width: 100%; display: flex; flex-direction: column; gap: 8px; }
    .page-header-actions .btn { width: 100%; justify-content: center; }
    .modal { margin: 16px; width: auto; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; }
    .student-strip { grid-template-columns: 1fr; text-align: center; justify-items: center; }
    .student-meta { justify-content: center; }
    .fee-stat-chips { justify-content: center; }
    .profile-hero { flex-direction: column; text-align: center; }
    .profile-meta { justify-content: center; }
    .search-bar { width: 100%; }
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; border: 1px solid var(--border); border-radius: var(--radius-md); }
    .topbar-title h1 { font-size: 16px; }
}
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr !important; }
    .btn { padding: 8px 12px; font-size: 13px; }
    .inst-card { flex-direction: column; align-items: flex-start; }
    .inst-card-row { flex-direction: column; align-items: flex-start; gap: 2px; }
    .inst-card-row > span:last-child { margin-left: 0; font-weight: 700; }
}


@media (max-width: 768px) {
    .topbar-actions .btn { display: none !important; }
    .table-wrap table { min-width: 800px; }
    .table-wrap th, .table-wrap td { white-space: nowrap; }
}


.page-header, .card-header { flex-wrap: wrap; }
@media (max-width: 960px) { .late-fee-layout, .late-fee-stats { grid-template-columns: 1fr !important; } }
