:root {
    --primary-color: #1a3a8a;
    --secondary-color: #3b82f6;
    --accent-color: #f59e0b;
    --bg-light: #f3f4f6;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Form Sections styling */
.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 1rem;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 700;
}

.form-section-title i {
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

/* Responsive Grid Utilities */
.grid-stack { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grid-2-col { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4-col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

@media (max-width: 1200px) {
    .form-grid { grid-template-columns: repeat(3, 1fr); }
    .grid-4-col { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-3-col, .grid-4-col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .grid-2-col, .grid-3-col, .grid-4-col { grid-template-columns: 1fr; }
    
    /* Reset all spans to 1 on mobile to prevent overflow */
    .grid-2-col > *, .grid-3-col > *, .grid-4-col > *, .form-grid > * {
        grid-column: span 1 !important;
    }
    
    /* Global stacking helper */
    .stack-on-mobile {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }
}

.grid-main-sidebar, .grid-2-1 {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.grid-2-1 {
    grid-template-columns: 2fr 1fr;
}

@media (max-width: 1023px) {
    .grid-main-sidebar, .grid-2-1 {
        grid-template-columns: 1fr;
    }
}
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card .logo {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 2rem;
}

.login-card h2 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #1e40af;
}

.role-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.role-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.role-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.footer-links {
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

.footer-links a {
    color: var(--secondary-color);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--primary-color);
    color: var(--white);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Global Hidden/Collapsed State for Desktop */
.sidebar-collapsed .sidebar {
    margin-left: -260px;
    pointer-events: none;
}
.sidebar-collapsed .main-content {
    margin-left: 0 !important;
}

.main-content {
    flex-grow: 1;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent flex-item from overflowing */
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.sidebar-close-btn {
    display: none !important;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}

.sidebar-header i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.sidebar-menu {
    padding: 1rem 0;
}

.sidebar-item {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.sidebar-item i {
    width: 20px;
}

.main-content {
    flex-grow: 1;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    cursor: pointer;
}

/* Profile Dropdown */
.user-profile {
    position: relative;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.75rem;
    transition: background 0.2s;
}

.user-profile:hover {
    background: #f8fafc;
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background: var(--white);
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #f3f4f6;
    display: none !important;
    /* Force hide by default */
    z-index: 2000;
    overflow: hidden;
    padding: 0.5rem;
    animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.user-profile.active .profile-dropdown-menu {
    display: block !important;
    /* Force show when active */
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: #f9fafb;
    color: var(--primary-color);
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 1rem;
    color: var(--text-muted);
}

.dropdown-item:hover i {
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 0.5rem 0;
}

.dropdown-item.logout {
    color: #ef4444;
}

.dropdown-item.logout:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.dropdown-item.logout i {
    color: #ef4444;
}

.content-wrapper {
    padding: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Premium Reports UI */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.report-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
}

.report-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--secondary-color);
}

.report-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100px; height: 100px;
    background: linear-gradient(135deg, transparent 50%, rgba(59, 130, 246, 0.03) 100%);
    border-radius: 0 0 0 100%;
}

.report-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: #f8fafc;
    transition: all 0.3s ease;
}

.report-card:hover .report-card-icon {
    transform: scale(1.1) rotate(-5deg);
}

.report-card-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.report-card-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.report-card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.875rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.report-card:hover .report-card-footer {
    opacity: 1;
}

.pink {
    background: rgba(219, 39, 119, 0.1);
    color: #db2777;
}

.green {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.orange {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

/* UI Components */
.table-container {
    background: var(--white);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    overflow-x: auto;
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    border-bottom: 2px solid #f3f4f6;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9375rem;
}

.btn-action {
    padding: 0.5rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #f3f4f6;
    color: var(--text-dark);
}

.btn-edit:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--secondary-color);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
    display: none; /* Controlled by .active */
    align-items: center; /* Center the white box vertically */
    justify-content: center; /* Center the white box horizontally */
    padding: 1.5rem; /* Space around the box for mobile */
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 900px;
    position: relative;
    max-height: 90vh; /* Allow it to be tall but not off-screen */
    overflow-y: auto; /* Internal scrolling! */
    animation: slideUp 0.3s ease-out;
}

/* Custom Scrollbar for Modal Content */
.modal-content::-webkit-scrollbar {
    width: 12px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border: 3px solid #f1f5f9;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Badges & Alerts */
.badge {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Assignment Card Grid */
.assignment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.assignment-card {
    background: var(--white);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.assignment-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--secondary-color);
}

.assignment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.assignment-class {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.assignment-section {
    font-size: 0.875rem;
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    color: #475569;
    font-weight: 500;
}

.assignment-subject {
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assignment-subject i {
    color: var(--secondary-color);
}

.assignment-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.assignment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-attendance {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.btn-attendance:hover {
    background: #2563eb;
    color: var(--white);
}

.btn-marks {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.btn-marks:hover {
    background: #7c3aed;
    color: var(--white);
}

.role-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-top: 0.5rem;
}

.role-tag.class-teacher {
    color: #059669;
}

.role-tag.subject-teacher {
    color: #94a3b8;
}

/* =============================================
   HAMBURGER BUTTON (hidden on desktop)
   ============================================= */
.sidebar-toggle {
    display: flex; /* Always flex on all sizes now */
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 0.75rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.sidebar-toggle:hover { 
    background: #f1f5f9; 
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
.sidebar-toggle:active {
    transform: translateY(0);
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 998;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* =============================================
   BRAND HEADER BAR
   ============================================= */
.brand-header-bar {
    background: #ffffff;
    border-bottom: 1.5px solid #e8ecf3;
    padding: 0.55rem 2rem;
    display: flex;
    align-items: center;
}
.brand-header-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.brand-logo {
    width: 52px !important;
    height: 52px !important;
    max-width: 52px !important;
    object-fit: contain;
    flex-shrink: 0;
}
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.brand-name {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1a3a8a;
    letter-spacing: -0.01em;
    font-family: 'Inter', sans-serif;
}
.brand-sub {
    font-size: 0.62rem;
    font-weight: 700;
    color: #0d9488;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

/* =============================================
   TABLET  768px – 1023px
   ============================================= */
@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 260px;
        overflow-y: auto;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0 !important; width: 100%; }

    .sidebar-toggle { 
        display: flex !important; 
    }

    .sidebar-close-btn { display: block !important; }

    /* Brand header compact */
    .brand-header-bar { padding: 0.45rem 1rem; }
    .brand-logo { width: 38px; height: 38px; }
    .brand-name { font-size: 1.05rem; }
    .brand-sub { font-size: 0.55rem; }

    /* Top bar wrapping */
    .top-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem 1.25rem;
    }
    .top-bar > div { flex-wrap: wrap; gap: 0.5rem; }

    /* Content padding */
    .content-wrapper { padding: 1.25rem; }

    /* Stat cards 2-col */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* Tables scroll */
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 600px; }

    /* Modal full-width */
    .modal-content { max-width: 95vw !important; margin: 1rem; }

    /* Settings grid */
    .settings-grid { grid-template-columns: 1fr; padding: 1.25rem; }
    .config-section { padding: 0 1.25rem 1.25rem; }

    /* Class breakdown cards scroll */
    #classBreakdownCards { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.5rem; }
}

/* =============================================
   MOBILE  ≤ 767px
   ============================================= */
@media (max-width: 767px) {
    /* Full-width sidebar on mobile too */
    .sidebar { width: 85vw; max-width: 300px; }

    /* Brand header */
    .brand-header-bar { padding: 0.4rem 0.875rem; }
    .brand-name { font-size: 0.95rem; }
    .brand-sub { display: none; }

    /* Top bar stack */
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    .top-bar > div:last-child {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    /* Search box full width */
    .search-box { width: 100% !important; }
    .search-box input { width: 100% !important; }

    /* Hide text labels on action buttons, show icons only */
    .top-bar .btn-action span.btn-label { display: none; }

    /* Content */
    .content-wrapper { padding: 0.875rem; }

    /* Stat cards single column */
    .stats-grid,
    div[style*="grid-template-columns: repeat(auto-fit, minmax(200px"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.75rem !important;
    }

    /* Tables */
    table { min-width: 500px; font-size: 0.8125rem; }
    th, td { padding: 0.625rem 0.75rem; }

    /* Modals full screen */
    .modal { padding: 10px; }
    .modal-content {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 1rem !important;
        padding: 1.5rem !important;
        margin: 0 !important;
        max-height: 95vh !important;
    }
    .modal-header { border-radius: 1.25rem 1.25rem 0 0 !important; }

    /* Form grids */
    div[style*="grid-template-columns: repeat(3, 1fr)"],
    div[style*="grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* Class filter bar stack */
    div[style*="display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; padding"] {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Class breakdown cards - horizontal scroll */
    #classBreakdownCards {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    .class-stat-card { min-width: 140px; }

    /* Settings */
    .settings-grid { padding: 0.875rem; gap: 1rem; }
    .config-section { padding: 0 0.875rem 0.875rem; }

    /* Profile dropdown */
    .profile-dropdown-menu { right: 0 !important; left: auto !important; width: 200px !important; }

    /* Sidebar sub-items */
    .sidebar-item.sub { padding-left: 2.5rem; }

    /* Print hide responsive chrome */
    @media print {
        .brand-header-bar { display: none !important; }
    }
}

/* =============================================
   PREMIUM PILL-STYLE FORMS (add_student.php)
   ============================================= */
.premium-form-container {
    background: #f8fafc;
    border-radius: 2rem;
    padding: 2.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.premium-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2.5rem 0 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.premium-section-number {
    background: #1e293b;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.premium-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.premium-form-group {
    position: relative;
    margin-bottom: 2rem;
}

.premium-label {
    position: absolute;
    top: -12px;
    left: 20px;
    background: #6366f1; /* Purple/Indigo theme from screenshot */
    color: #fff;
    padding: 2px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.premium-label.optional {
    background: #94a3b8;
}

.premium-control {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 3rem; /* Highly rounded as per screenshot */
    font-size: 0.95rem;
    color: #1e293b;
    background: #fff;
    transition: all 0.3s ease;
}

.premium-control:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

select.premium-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.25rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

.premium-btn-add {
    background: #f59e0b; /* Orange/Yellow from screenshot */
    color: #fff;
    padding: 0.75rem 2rem;
    border-radius: 3rem;
    border: none;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.premium-btn-add:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* Page Scrollbar */
.premium-page-container::-webkit-scrollbar {
    width: 12px;
}
.premium-page-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.premium-page-container::-webkit-scrollbar-thumb {
    background: #6366f1;
    border: 3px solid #f1f5f9;
    border-radius: 10px;
}