/* =========================================
            1. CSS VARIABLES
            ========================================= */
:root {
    --bg-secondary: #f4f6f8;
    --text-primary: #333333;
    --secondary-color: #2c3e50; /* Sidebar Color */
    --surface-color: #ffffff;
    --primary-color: #3498db;
    --border-color: #e0e0e0;
    --border-radius: 8px;
    --spacing-unit: 16px;
    --sidebar-width: 260px;
    --header-height: 48px; /* Matched with styles.css */
    --footer-height: 36px;
    --profile-page-font-scale: 2;
}

/* =========================================
            2. RESET & BASE STYLES
            ========================================= */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: auto;
}

html.device-mobile {
    --mobile-header-school-name-font-size: 1.5rem;
    --mobile-footer-elements-font-size: 1.2rem;
    --mobile-header-height: 70px;
    --mobile-footer-height: 70px;
    --mobile-sidebar-width: 300px;
    --mobile-phone-sidebar-features-font-size: 30px;
    --mobile-tablet-sidebar-features-font-size: 22px;
    --mobile-sidebar-features-font-size: var(--mobile-phone-sidebar-features-font-size);
    --attendance-form-font-size: 22px;
    --sidebar-width: var(--mobile-sidebar-width);
    --header-height: var(--mobile-header-height);
    --footer-height: var(--footer-safe, var(--mobile-footer-height));
}

html.device-mobile.device-phone {
    --mobile-root-font-size: 22px;
    font-size: var(--mobile-root-font-size);
}

html.device-mobile.device-tablet {
    --mobile-sidebar-features-font-size: var(--mobile-tablet-sidebar-features-font-size);
}

html.device-mobile .attendance-form-scope {
    font-size: var(--attendance-form-font-size) !important;
}

html.device-mobile .attendance-form-scope .form-control,
html.device-mobile .attendance-form-scope .form-select,
html.device-mobile .attendance-form-scope .form-label,
html.device-mobile .attendance-form-scope .btn,
html.device-mobile .attendance-form-scope table,
html.device-mobile .attendance-form-scope .table {
    font-size: inherit !important;
}

html.device-mobile body {
    overflow-x: auto !important;
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh !important;
    width: auto !important;
    max-width: none !important;
    padding-bottom: 0 !important;
}

html.device-mobile body:not(.has-dashboard-layout) {
    padding-bottom: calc(24px + var(--footer-safe, 80px)) !important;
}

html.device-mobile body.has-dashboard-layout {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh !important;
}

html.device-mobile body.has-dashboard-layout.has-dashboard-layout {
    padding-bottom: 0 !important;
}

html.device-mobile #header-container .main-header {
    height: var(--mobile-header-height) !important;
}

html.device-mobile #header-container .main-header .school-name,
html.device-mobile #header-container #header-school-name {
    font-size: var(--mobile-header-school-name-font-size) !important;
}

html.device-mobile #footer-container .main-footer {
    height: var(--mobile-footer-height) !important;
    display: flex !important;
    align-items: center !important;
}

html.device-mobile #footer-container .main-footer .copyright,
html.device-mobile #footer-container .main-footer .contact-link {
    font-size: var(--mobile-footer-elements-font-size) !important;
}

html.device-mobile body.has-dashboard-layout {
    overflow-x: auto !important;
    overflow-y: auto !important; /* Allow body to scroll as fallback */
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
}

html.device-mobile body.has-dashboard-layout .dashboard-container {
    height: calc(var(--app-height, 100dvh) - var(--header-height) - var(--footer-height)) !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
}

html.device-mobile body.has-dashboard-layout .sidebar {
    height: 100% !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
}

html.device-mobile body.has-dashboard-layout .sidebar-inner {
    height: 100% !important;
    overflow-y: auto !important;
    padding-bottom: 0 !important;
    scroll-padding-bottom: 0 !important;
}

html.device-mobile body.has-dashboard-layout .main-content {
    height: 100% !important;
    overflow-y: auto !important;
    padding-bottom: 0 !important;
    scroll-padding-bottom: 0 !important;
}

html.device-mobile body.has-dashboard-layout .main-content > :last-child {
    margin-bottom: 0 !important;
}

html.device-mobile body.has-dashboard-layout .dashboard-container .main-content,
html.device-mobile body.has-dashboard-layout .dashboard-container .sidebar-inner {
    padding-bottom: 0 !important;
    scroll-padding-bottom: 0 !important;
}

/* =========================================
            3. LAYOUT COMPONENTS
            ========================================= */

/* The wrapper */
.dashboard-container {
    width: 100%;
    display: flex;
    min-height: 100vh;
    /* Ensures the flex children (sidebar) stretch to full height */
    align-items: stretch; 
}
html[dir="rtl"] .dashboard-container {
    flex-direction: row !important;
}
body.rtl .dashboard-container {
    flex-direction: row !important;
}
html[dir="rtl"] .dashboard-container > .main-content { order: 0 !important; }
html[dir="rtl"] .dashboard-container > .sidebar { order: 0 !important; margin-left: 0 !important; }
body.rtl .dashboard-container > .main-content { order: 0 !important; }
body.rtl .dashboard-container > .sidebar { order: 0 !important; margin-left: 0 !important; }

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-color);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
}

/* This div is the ONLY thing that scrolls inside the sidebar */
.sidebar-inner {
    flex-grow: 1;
    overflow-y: auto; /* Enable scroll */
    height: 100%;
    padding: 20px;
}

/* Hide scrollbar for cleaner look */
.sidebar-inner::-webkit-scrollbar { width: 0px; background: transparent; }

.sidebar h2 { margin: 0 0 1rem 0; font-size: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 1rem; }

.sidebar nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar nav li { margin-bottom: 0.5rem; }
.sidebar nav a { color: #ecf0f1; text-decoration: none; display: block; padding: 15px; border-radius: 4px; white-space: nowrap; }
.sidebar nav a:hover { background-color: rgba(255,255,255,0.1); }
html.device-mobile body.has-dashboard-layout .sidebar nav a,
html.device-mobile body.has-dashboard-layout .sidebar nav button,
html.device-mobile body.has-dashboard-layout .sidebar .nav-menu a,
html.device-mobile body.has-dashboard-layout .sidebar .nav-menu button,
html.device-mobile body.has-dashboard-layout .nav-menu a,
html.device-mobile body.has-dashboard-layout .nav-menu button {
    font-size: var(--mobile-sidebar-features-font-size) !important;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    opacity: 0.7;
    background: var(--secondary-color);
    flex-shrink: 0;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex-grow: 1;
    padding: 30px;
    background-color: var(--bg-secondary);
}

/* --- DEMO CARDS --- */
.card {
    background: var(--surface-color);
    padding: var(--spacing-unit);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    width: 100%;
    margin-bottom: var(--spacing-unit);
}



/* =========================================
            4. MOBILE / RESPONSIVE ADJUSTMENTS
            ========================================= */
@media (max-width: 1023px) {
    html.device-mobile body {
        --layout-min-width: 1024px;
    }

    html.device-mobile {
        background: var(--bg-secondary) !important;
    }

    html.device-mobile,
    html.device-mobile body {
        width: auto !important; /* Allow natural width */
        min-width: 100% !important;
        max-width: none !important; /* Fixed: Remove 100vw limit for zoom */
        overflow-x: auto !important;
        overflow-y: auto !important;
        min-height: 100vh !important;
        height: auto !important;
        scroll-behavior: smooth !important;
        background: var(--bg-secondary) !important;
    }
    html.device-mobile body.has-dashboard-layout {
        overflow-x: auto !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
    }
    html.device-mobile #header-container,
    html.device-mobile #footer-container {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 auto !important;
    }

    html.device-mobile #footer-container {
        margin-top: auto !important;
    }

    html.device-mobile body {
        background: var(--bg-secondary) !important;
    }

    html.device-mobile body.has-dashboard-layout #header-container {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: auto !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }

    html.device-mobile body.has-dashboard-layout #footer-container {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: auto !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        margin-top: auto !important;
    }
    
    html.device-mobile #footer-container .main-footer {
        height: var(--footer-height) !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        display: flex !important;
        align-items: center !important;
        overflow: hidden !important;
    }
    html.device-mobile #footer-container .main-footer .footer-content {
        width: 100% !important;
        height: 100% !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        overflow: hidden !important;
    }
    html.device-mobile #footer-container .main-footer .footer-section {
        min-width: 0 !important;
        flex: 1 1 0 !important;
        justify-content: center !important;
    }
    html.device-mobile #footer-container .main-footer .contact-link,
    html.device-mobile #footer-container .main-footer .copyright {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
        font-size: 0.7rem !important;
    }

    /* 1. NO GLOBAL HEADER ON MOBILE */
    html.device-mobile .sidebar-header {
        position: relative !important;
        width: 100% !important;
        z-index: 1 !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    html.device-mobile[dir="rtl"] .sidebar-header {
        left: auto !important;
        right: auto !important;
    }

    /* 2. DASHBOARD CONTAINER: SIDE-BY-SIDE */
    html.device-mobile .dashboard-container {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        width: auto !important; /* Allow expansion for zoom */
        min-width: 100% !important;
        max-width: none !important; /* Allow expansion for zoom */
        flex: 1 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        min-height: calc(100vh - var(--header-height) - var(--footer-height)) !important;
        height: auto !important;
        overflow: auto !important;
        background: var(--bg-secondary) !important;
    }

    html.device-mobile body.has-dashboard-layout .dashboard-container {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    html.device-mobile body.has-dashboard-layout .sidebar {
        height: 100% !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: auto !important;
        padding-bottom: 0 !important;
    }

    html.device-mobile body.has-dashboard-layout .main-content {
        height: auto !important;
        min-height: 0 !important;
        overflow-y: visible !important;
        overflow-x: auto !important;
    }

    html.device-mobile body.attendance-page .attendance-stats-row {
        flex-direction: row !important;
        flex-wrap: wrap !important;
    }
    html.device-mobile body.attendance-page .attendance-stats-row > .col-md-3 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }

    html.device-mobile body.attendance-page .filter-row {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: flex-end !important;
    }
    html.device-mobile body.attendance-page .filter-item {
        flex: 1 1 220px !important;
        min-width: 220px !important;
        width: auto !important;
    }
    html.device-mobile[dir="rtl"] .dashboard-container {
        flex-direction: row !important;
    }

    /* 3. SIDEBAR */
    html.device-mobile .sidebar {
        flex: 0 0 var(--sidebar-width) !important;
        width: var(--sidebar-width) !important;
        height: auto !important;
        min-height: 0 !important;
        background-color: var(--secondary-color) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 900 !important; /* Lowered below header z-index (1000) */
        padding-bottom: var(--footer-height) !important;
    }
    html.device-mobile .sidebar.collapsed {
        width: 0 !important;
        min-width: 0 !important;
        flex: 0 0 0 !important;
        overflow: hidden !important;
    }
    html.device-mobile[dir="rtl"] .sidebar {
        left: auto !important;
        right: 0 !important;
        order: 1 !important;
    }

    /* 4. MAIN CONTENT */
    html.device-mobile .main-content {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: auto !important;
        display: flex !important;
        flex-direction: column !important;
        margin: 0 !important;
        padding: 20px !important;
        padding-bottom: calc(20px + var(--footer-height)) !important;
        scroll-padding-bottom: var(--footer-height) !important;
    }

    html.device-mobile body.has-dashboard-layout .sidebar {
        height: 100% !important;
        min-height: 0 !important;
        overflow: auto !important; /* Fixed: Allow scrolling on mobile */
        padding-bottom: 0 !important;
        z-index: 1000 !important; /* Ensure sidebar is visible above other content but below header */
    }
    html.device-mobile body.has-dashboard-layout .sidebar-inner {
        height: 100% !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        padding-bottom: calc(40px + var(--footer-height)) !important;
        scroll-padding-bottom: var(--footer-height) !important;
        box-sizing: border-box !important;
    }
    html.device-mobile body.has-dashboard-layout .nav-menu {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-bottom: calc(60px + var(--footer-height)) !important;
        scroll-padding-bottom: var(--footer-height) !important;
        box-sizing: border-box !important;
    }
    html.device-mobile body.has-dashboard-layout .main-content {
        height: auto !important;
        min-height: 0 !important;
        overflow-y: visible !important;
        padding-bottom: calc(60px + var(--footer-height)) !important;
        scroll-padding-bottom: var(--footer-height) !important;
        box-sizing: border-box !important;
    }
    html.device-mobile[dir="rtl"] .main-content {
        order: 2 !important;
    }

    /* Ensure the sidebar/content gap is retained on mobile, including RTL */
    html.device-mobile body.has-dashboard-layout .sidebar:not(.collapsed) ~ .main-content {
        margin-left: 0 !important;
    }
    html[dir="rtl"].device-mobile body.has-dashboard-layout .sidebar:not(.collapsed) ~ .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* 6. GRID & LAYOUT FIXES FOR DESKTOP WIDTH ON MOBILE */
    html.device-mobile .grid-2,
    html.device-mobile .grid-3,
    html.device-mobile .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    html.device-mobile .filter-container {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* 7. FOOTER */
    html.device-mobile .app-footer {
        position: relative !important;
        width: 100% !important;
    }

}

/* Mobile dotted action dropdown: open upward when near bottom */
@media (max-width: 1023px) {
    html.device-mobile .global-dropdown-menu.mobile-upward {
        transform: translateY(-100%);
        transform-origin: bottom center;
    }
}

html.device-mobile .global-dropdown-menu,
html.device-mobile .action-menu-dotted,
html.device-mobile .ws-action-menu {
    z-index: 2147483647 !important;
    pointer-events: auto !important;
}

@media (max-width: 1023px) and (hover: none) and (pointer: coarse) {
    html.device-mobile .global-dropdown-menu,
    html.device-mobile .action-menu-dotted,
    html.device-mobile .ws-action-menu {
        z-index: 2147483647 !important;
        pointer-events: auto !important;
    }
}

html.device-mobile {
    --desktop-layout-width: 1024px;
    --desktop-fit-scale: 0.35;
    width: 100vw !important;
    height: 100vh !important;
    height: 100svh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    min-height: 100svh !important;
    min-height: 100dvh !important;
}

html.device-mobile,
html.device-mobile body {
    overflow-x: auto !important;
    overflow-y: auto !important;
    touch-action: pan-x pan-y pinch-zoom;
    -ms-touch-action: pan-x pan-y pinch-zoom;
    -webkit-overflow-scrolling: touch;
}

html.device-mobile body {
    width: var(--desktop-layout-width) !important;
    min-width: var(--desktop-layout-width) !important;
    max-width: none !important;
    transform-origin: top left;
}

html.device-mobile.device-tablet {
    --desktop-layout-width: 100%;
    --desktop-fit-scale: 1;
}

html.device-mobile.device-tablet body {
    width: 100% !important;
    min-width: 100% !important;
}

html.device-mobile.device-tablet body.has-dashboard-layout #footer-container {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

html.device-mobile.device-tablet body.has-dashboard-layout #header-container {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

html.device-mobile body.has-dashboard-layout {
    display: flex !important;
    flex-direction: column !important;
}

html.device-mobile body.has-dashboard-layout #header-container,
html.device-mobile body.has-dashboard-layout #footer-container {
    flex: 0 0 auto !important;
}

html.device-mobile body.has-dashboard-layout #header-container {
    margin-top: 0 !important;
    position: fixed !important;
    left: 0 !important;
    right: auto !important;
    top: 0 !important;
    bottom: auto !important;
    width: var(--desktop-layout-width) !important;
    min-width: var(--desktop-layout-width) !important;
    max-width: var(--desktop-layout-width) !important;
    z-index: 1600 !important;
}

html.device-mobile body.has-dashboard-layout #footer-container {
    margin-top: 0 !important;
    position: fixed !important;
    left: 0 !important;
    right: auto !important;
    bottom: 0 !important;
    top: auto !important;
    width: var(--desktop-layout-width) !important;
    min-width: var(--desktop-layout-width) !important;
    max-width: var(--desktop-layout-width) !important;
    z-index: 1500 !important;
}

html.device-mobile body.has-dashboard-layout .dashboard-container {
    flex: 1 1 auto !important;
    height: calc((100vh / var(--desktop-fit-scale)) - var(--header-height) - var(--footer-height)) !important;
    margin-top: var(--header-height) !important;
    margin-bottom: var(--footer-height) !important;
    min-height: 0 !important;
}

@supports (zoom: 1) {
    html.device-mobile body {
        zoom: var(--desktop-fit-scale) !important;
        transform: none !important;
    }
}

@supports (zoom: 1) {
    html.device-mobile.device-tablet body {
        zoom: 1 !important;
        transform: none !important;
    }
}

@supports not (zoom: 1) {
    html.device-mobile body {
        transform: scale(var(--desktop-fit-scale)) !important;
        width: calc(100vw / var(--desktop-fit-scale)) !important;
        min-width: calc(100vw / var(--desktop-fit-scale)) !important;
        height: calc(100vh / var(--desktop-fit-scale)) !important;
        min-height: calc(100vh / var(--desktop-fit-scale)) !important;
    }
}

@supports not (zoom: 1) {
    html.device-mobile body.has-dashboard-layout {
        --desktop-fit-scale: 1 !important;
        --desktop-layout-width: 100% !important;
        transform: none !important;
        width: 100% !important;
        min-width: 100% !important;
        height: auto !important;
        min-height: 100vh !important;
    }
}

@supports not (zoom: 1) {
    html.device-mobile body.has-dashboard-layout #footer-container {
        width: var(--desktop-layout-width) !important;
        min-width: var(--desktop-layout-width) !important;
        max-width: var(--desktop-layout-width) !important;
    }
}

@supports not (zoom: 1) {
    html.device-mobile body.has-dashboard-layout #header-container {
        width: var(--desktop-layout-width) !important;
        min-width: var(--desktop-layout-width) !important;
        max-width: var(--desktop-layout-width) !important;
    }
}

@supports not (zoom: 1) {
    html.device-mobile.device-tablet body {
        transform: none !important;
        height: auto !important;
        min-height: 100vh !important;
    }
}

html.device-mobile .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
html.device-mobile .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}
html.device-mobile .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}
html.device-mobile .grid-3 > :last-child:nth-child(3n+1) {
    grid-column: 1 / -1;
}
html.device-mobile #lessonPlanInline .form-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}
html.device-mobile #lessonPlanInline .form-row > .form-group:last-child:nth-child(odd) {
    grid-column: auto !important;
}
html.device-mobile #lessonPlanInline .form-row > .form-group:last-child:nth-child(3n+1) {
    grid-column: 1 / -1 !important;
}
html.device-mobile .filter-container {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

@media (max-width: 1023px) and (hover: none) and (pointer: coarse) {
    html.device-mobile .grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
    html.device-mobile .grid-3 > :last-child:nth-child(3n+1) {
        grid-column: 1 / -1;
    }
    html.device-mobile #lessonPlanInline .form-row {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
    html.device-mobile #lessonPlanInline .form-row > .form-group:last-child:nth-child(odd) {
        grid-column: auto !important;
    }
    html.device-mobile #lessonPlanInline .form-row > .form-group:last-child:nth-child(3n+1) {
        grid-column: 1 / -1 !important;
    }
}

@media (min-width: 360px) {
    html.device-mobile { --desktop-fit-scale: 0.35; }
}
@media (min-width: 375px) {
    html.device-mobile { --desktop-fit-scale: 0.37; }
}
@media (min-width: 390px) {
    html.device-mobile { --desktop-fit-scale: 0.38; }
}
@media (min-width: 414px) {
    html.device-mobile { --desktop-fit-scale: 0.40; }
}
@media (min-width: 480px) {
    html.device-mobile { --desktop-fit-scale: 0.47; }
}
@media (min-width: 540px) {
    html.device-mobile { --desktop-fit-scale: 0.52; }
}
@media (min-width: 600px) {
    html.device-mobile { --desktop-fit-scale: 0.59; }
}
@media (min-width: 768px) {
    html.device-mobile { --desktop-fit-scale: 0.75; }
}
@media (min-width: 820px) {
    html.device-mobile { --desktop-fit-scale: 0.80; }
}
@media (min-width: 912px) {
    html.device-mobile { --desktop-fit-scale: 0.89; }
}
@media (min-width: 960px) {
    html.device-mobile { --desktop-fit-scale: 0.94; }
}

@media (max-width: 1023px) {
    html.device-mobile {
        --desktop-layout-width: 1024px;
        --desktop-fit-scale: 0.35;
    }
    html.device-mobile body.has-dashboard-layout {
        width: var(--desktop-layout-width) !important;
        min-width: var(--desktop-layout-width) !important;
        max-width: none !important;
        transform-origin: top left;
    }
    @supports (zoom: 1) {
        html.device-mobile body.has-dashboard-layout {
            zoom: var(--desktop-fit-scale) !important;
            transform: none !important;
        }
    }
    @supports not (zoom: 1) {
        html.device-mobile body.has-dashboard-layout {
            transform: scale(var(--desktop-fit-scale)) !important;
            height: calc(100vh / var(--desktop-fit-scale)) !important;
            min-height: calc(100vh / var(--desktop-fit-scale)) !important;
        }
    }
}

@media (max-width: 1023px) and (min-width: 375px) { html.device-mobile { --desktop-fit-scale: 0.37; } }
@media (max-width: 1023px) and (min-width: 390px) { html.device-mobile { --desktop-fit-scale: 0.38; } }
@media (max-width: 1023px) and (min-width: 414px) { html.device-mobile { --desktop-fit-scale: 0.40; } }
@media (max-width: 1023px) and (min-width: 480px) { html.device-mobile { --desktop-fit-scale: 0.47; } }
@media (max-width: 1023px) and (min-width: 540px) { html.device-mobile { --desktop-fit-scale: 0.52; } }
@media (max-width: 1023px) and (min-width: 600px) { html.device-mobile { --desktop-fit-scale: 0.59; } }
@media (max-width: 1023px) and (min-width: 768px) { html.device-mobile { --desktop-fit-scale: 0.75; } }
@media (max-width: 1023px) and (min-width: 820px) { html.device-mobile { --desktop-fit-scale: 0.80; } }
@media (max-width: 1023px) and (min-width: 912px) { html.device-mobile { --desktop-fit-scale: 0.89; } }
@media (max-width: 1023px) and (min-width: 960px) { html.device-mobile { --desktop-fit-scale: 0.94; } }

html.device-mobile .sidebar .nav-menu .nav-item:last-child {
    margin-top: 12px !important;
    padding-top: 12px !important;
}

html.device-mobile .dashboard-container .grid .stat-card .stat-number,
html.device-mobile .dashboard-container .grid .stat-card .stat-label,
html.device-mobile .dashboard-container .grid .stat-card .stat-change,
html.device-mobile .dashboard-container .stat-card .stat-number,
html.device-mobile .dashboard-container .stat-card .stat-label,
html.device-mobile .dashboard-container .stat-card .stat-change,
html.device-mobile .dashboard-container .form-group label,
html.device-mobile .dashboard-container .form-label,
html.device-mobile .dashboard-container .form-control,
html.device-mobile .dashboard-container .modern-input,
html.device-mobile .dashboard-container .modern-select,
html.device-mobile .dashboard-container .form-select,
html.device-mobile .dashboard-container form label,
html.device-mobile .dashboard-container form input,
html.device-mobile .dashboard-container form select,
html.device-mobile .dashboard-container form textarea,
html.device-mobile .dashboard-container form button {
  font-size: 23px !important;
}

html.device-mobile {
    --results-marks-table-font-size: 23px;
}

html.device-mobile .dashboard-container .results-entry-form .modern-table tbody td,
html.device-mobile .dashboard-container .results-entry-form .modern-table thead th,
html.device-mobile .dashboard-container .results-entry-form .mark-input,
html.device-mobile .dashboard-container .results-entry-form .total-mark {
    font-size: var(--results-marks-table-font-size) !important;
}

@viewport {
    width: device-width;
    height: device-height;
    zoom: 1;
    min-zoom: 1;
    max-zoom: 5;
    user-zoom: zoom;
}

@-ms-viewport {
    width: device-width;
    height: device-height;
    zoom: 1;
    min-zoom: 1;
    max-zoom: 5;
    user-zoom: zoom;
}

@media (max-width: 1279px) and (any-hover: none) {
    html.device-mobile body.user-management-page .form-section.credentials-section #credentialsFields { width: 100% !important; max-width: none !important; }
    html.device-mobile body.user-management-page .form-section.credentials-section #credentialsFields .form-grid { display: grid !important; width: 100% !important; grid-template-columns: 1fr !important; justify-items: stretch !important; }
    html.device-mobile body.user-management-page .form-section.credentials-section #credentialsFields .form-group, html.device-mobile body.user-management-page .form-section.credentials-section #credentialsFields .modern-input { width: 100% !important; max-width: none !important; }
    html.device-mobile #lessonPlanInline .form-row { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    html.device-mobile #lessonPlanInline .form-row > .form-group:last-child:nth-child(odd) { grid-column: auto !important; }
    html.device-mobile #lessonPlanInline .form-row > .form-group:last-child:nth-child(3n+1) { grid-column: 1 / -1 !important; }
    html.device-mobile .profile-card,
    html.device-mobile .profile-page,
    html.device-mobile #profile {
        font-size: calc(16px * var(--profile-page-font-scale)) !important;
    }
    html.device-mobile .profile-card .detail-label { font-size: calc(12px * var(--profile-page-font-scale)) !important; }
    html.device-mobile .profile-card .detail-value { font-size: calc(16px * var(--profile-page-font-scale)) !important; }
    html.device-mobile .profile-page .hero-name { font-size: calc(25.6px * var(--profile-page-font-scale)) !important; }
    html.device-mobile .profile-page .hero-initials { font-size: calc(25.6px * var(--profile-page-font-scale)) !important; }
    html.device-mobile .profile-page .chip { font-size: calc(14px * var(--profile-page-font-scale)) !important; }
    html.device-mobile .profile-page .info-label { font-size: calc(14px * var(--profile-page-font-scale)) !important; }
    html.device-mobile .profile-page .info-value { font-size: calc(16px * var(--profile-page-font-scale)) !important; }
    html.device-mobile .profile-page .profile-subtitle { font-size: calc(18px * var(--profile-page-font-scale)) !important; }
    html.device-mobile #profile .profile-name { font-size: calc(35.2px * var(--profile-page-font-scale)) !important; }
    html.device-mobile #profile .profile-role-badge { font-size: calc(14.4px * var(--profile-page-font-scale)) !important; }
    html.device-mobile #profile .profile-avatar { font-size: calc(32px * var(--profile-page-font-scale)) !important; }
    html.device-mobile #profile .info-label { font-size: calc(14.4px * var(--profile-page-font-scale)) !important; }
    html.device-mobile #profile .info-value { font-size: calc(17.6px * var(--profile-page-font-scale)) !important; }
    html.device-mobile #profile .record-label { font-size: calc(16px * var(--profile-page-font-scale)) !important; }
    html.device-mobile #profile .record-value { font-size: calc(16px * var(--profile-page-font-scale)) !important; }
    html.device-mobile #profile .guardian-title { font-size: calc(18px * var(--profile-page-font-scale)) !important; }
}

html.device-mobile body.has-global-header .sidebar-expand {
    display: none !important;
}

@media (max-width: 1279px) and (hover: none) and (pointer: coarse) {
    html.device-mobile body.has-global-header .sidebar-expand {
        display: none !important;
    }
}

html.device-mobile #footer-container {
    display: none !important;
}

html.device-mobile body.force-desktop-footer #footer-container {
    display: block !important;
}

html.device-mobile body.force-desktop-footer #mobile-footer-container {
    display: none !important;
}

@media (max-width: 768px) {
    #footer-container {
        display: none !important;
    }
    body.force-desktop-footer #footer-container {
        display: block !important;
    }
    body.force-desktop-footer #mobile-footer-container {
        display: none !important;
    }
}

.mobile-dashboard-infographic {
    display: none;
}

@media (max-width: 1279px) {
    .mobile-dashboard-infographic {
        display: flex;
        justify-content: center;
        width: 100vw;
        margin-left: calc(50% - 50vw);
        padding: 12px 8px 20px;
    }

    .mobile-dashboard-infographic img {
        width: min(96vw, 940px) !important;
        max-width: none !important;
        height: auto;
        display: block;
    }
}

@media (max-width: 1279px) and (hover: none) and (pointer: coarse) {
    html.device-mobile .sidebar,
    html.device-mobile body.has-dashboard-layout .sidebar {
        display: none !important;
        width: 0 !important;
        min-width: 0 !important;
        flex: 0 0 0 !important;
    }

    html.device-mobile .sidebar-expand,
    html.device-mobile body.has-dashboard-layout .sidebar-expand {
        display: none !important;
    }

    html.device-mobile #headerSidebarToggle,
    html.device-mobile .sidebar-toggle,
    html.device-mobile #header-container .main-header .menu-toggle.sidebar-toggle {
        display: none !important;
    }

    html.device-mobile #header-container .main-header .header-center {
        padding-left: 0 !important;
    }

    html[dir="rtl"].device-mobile #header-container .main-header > .header-center,
    body.rtl.device-mobile #header-container .main-header > .header-center {
        padding-right: 0 !important;
    }

    html.device-mobile body.school-admin-context .sidebar,
    html.device-mobile body.school-admin-context.has-dashboard-layout .sidebar {
        display: flex !important;
    }

    html.device-mobile body.school-admin-context .sidebar:not(.collapsed),
    html.device-mobile body.school-admin-context.has-dashboard-layout .sidebar:not(.collapsed) {
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
        flex: 0 0 var(--sidebar-width) !important;
    }

    html.device-mobile body.school-admin-context .sidebar.collapsed,
    html.device-mobile body.school-admin-context.has-dashboard-layout .sidebar.collapsed {
        width: 0 !important;
        min-width: 0 !important;
        flex: 0 0 0 !important;
        overflow: hidden !important;
    }

    html.device-mobile body.school-admin-context #headerSidebarToggle,
    html.device-mobile body.school-admin-context #header-container .main-header .menu-toggle.sidebar-toggle {
        display: inline-flex !important;
    }

    html.device-mobile body.school-admin-context #sidebarToggle,
    html.device-mobile body.school-admin-context .sidebar .sidebar-toggle {
        display: none !important;
    }
}

html.device-mobile body .results-entry-form .marks-table-scroll {
    overflow-x: auto !important;
}

html.device-mobile body .results-entry-form #marksEntryTable {
    width: max-content !important;
    min-width: 100% !important;
    table-layout: auto !important;
}

html.device-mobile body .results-entry-form #marksEntryTable th,
html.device-mobile body .results-entry-form #marksEntryTable td {
    max-width: none !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
}

html.device-mobile body .results-entry-form #marksEntryTable .mark-input {
    width: 130px !important;
    min-width: 130px !important;
}

html.device-mobile body .results-entry-form #marksEntryTable tbody td:nth-child(2) {
    font-size: 38px !important;
    line-height: 1.25 !important;
}

html.device-mobile body .attendance-form-scope .table-container .table-responsive {
    overflow-x: auto !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable,
html.device-mobile body .attendance-form-scope table.attendance-table {
    width: max-content !important;
    min-width: 100% !important;
    table-layout: auto !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable th,
html.device-mobile body .attendance-form-scope #attendanceStudentsTable td,
html.device-mobile body .attendance-form-scope table.attendance-table th,
html.device-mobile body .attendance-form-scope table.attendance-table td {
    max-width: none !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable tbody#studentListBody > tr > td:nth-child(2),
html.device-mobile body .attendance-form-scope table.attendance-table tbody#studentListBody > tr > td:nth-child(2),
html.device-mobile body .attendance-form-scope tbody#studentListBody > tr > td:nth-child(2),
html.device-mobile body .attendance-form-scope #attendanceStudentsTable tbody > tr > td:nth-child(2) {
    font-size: 38px !important;
    line-height: 1.25 !important;
}

html.device-mobile body .attendance-form-scope .form-grid select.form-control,
html.device-mobile body .attendance-form-scope .form-grid #attShiftSelect,
html.device-mobile body .attendance-form-scope .form-grid #attClassSelect,
html.device-mobile body .attendance-form-scope .form-grid #attAcademicYearSelect,
html.device-mobile body .attendance-form-scope .form-grid #attSubjectSelect {
    font-size: 28px !important;
    line-height: 1.2 !important;
    padding: 14px 16px !important;
}

html.device-mobile body .attendance-form-scope .form-grid select.form-control option {
    font-size: 28px !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable thead th:nth-child(1),
html.device-mobile body .attendance-form-scope table.attendance-table thead th:nth-child(1) {
    font-size: 24px !important;
    line-height: 1.2 !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable tbody > tr > td:nth-child(1),
html.device-mobile body .attendance-form-scope table.attendance-table tbody > tr > td:nth-child(1) {
    font-size: 32px !important;
    line-height: 1.25 !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable .att-status-label,
html.device-mobile body .attendance-form-scope table.attendance-table .att-status-label {
    font-size: 26px !important;
    line-height: 1.2 !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable select.att-status,
html.device-mobile body .attendance-form-scope table.attendance-table select.att-status {
    font-size: 28px !important;
    line-height: 1.2 !important;
    padding: 10px 14px !important;
    min-width: 180px !important;
}

html.device-mobile body #attStatusActionMenu .att-status-item {
    font-size: 28px !important;
    padding: 16px 18px !important;
}

html.device-mobile body .attendance-form-scope .form-grid select.form-control,
html.device-mobile body .attendance-form-scope .form-grid #attShiftSelect,
html.device-mobile body .attendance-form-scope .form-grid #attClassSelect,
html.device-mobile body .attendance-form-scope .form-grid #attAcademicYearSelect,
html.device-mobile body .attendance-form-scope .form-grid #attSubjectSelect,
html.device-mobile body .attendance-form-scope .form-grid #attExamSelect {
    font-size: 34px !important;
    line-height: 1.15 !important;
    padding: 16px 18px !important;
}

html.device-mobile body .attendance-form-scope .form-grid select.form-control option {
    font-size: 34px !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable tbody > tr > td:nth-child(1),
html.device-mobile body .attendance-form-scope table.attendance-table tbody > tr > td:nth-child(1) {
    font-size: 38px !important;
    line-height: 1.2 !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable .att-status-label,
html.device-mobile body .attendance-form-scope table.attendance-table .att-status-label {
    font-size: 32px !important;
    line-height: 1.15 !important;
}

html.device-mobile body .attendance-form-scope #attendanceStudentsTable select.att-status,
html.device-mobile body .attendance-form-scope table.attendance-table select.att-status {
    font-size: 34px !important;
    line-height: 1.15 !important;
    padding: 12px 16px !important;
    min-width: 210px !important;
}

html.device-mobile body #attStatusActionMenu .att-status-item {
    font-size: 32px !important;
}

html.device-mobile body .results-entry-form #marksEntryTable thead th {
    font-size: 30px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    padding: 18px 20px !important;
}

html.device-mobile body .results-entry-form #marksEntryTable tbody > tr > td:nth-child(1) {
    font-size: 36px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    padding: 16px 20px !important;
}

html.device-mobile body .results-entry-form #marksEntryTable .mark-input {
    font-size: 30px !important;
    line-height: 1.2 !important;
    padding: 16px 18px !important;
    height: 70px !important;
    min-height: 70px !important;
    border-radius: 10px !important;
}

html.device-mobile body .results-entry-form #marksEntryTable .total-mark {
    font-size: 34px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    padding: 16px 20px !important;
}

html.device-mobile body .results-entry-form .form-actions .btn,
html.device-mobile body .results-entry-form #saveResultsBtn,
html.device-mobile body .results-entry-form #cancelBtn {
    font-size: 32px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    padding: 22px 32px !important;
    min-height: 80px !important;
    height: auto !important;
    border-radius: 14px !important;
    margin-top: 12px !important;
    margin-bottom: 12px !important;
}

html.device-mobile body #results-section #addMarksBtn,
html.device-mobile body #results-section #editMarksBtn {
    font-size: 30px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    padding: 20px 30px !important;
    min-height: 76px !important;
    height: auto !important;
    border-radius: 14px !important;
}

html.device-mobile body .results-entry-form .form-actions .btn i,
html.device-mobile body .results-entry-form #saveResultsBtn i,
html.device-mobile body .results-entry-form #cancelBtn i,
html.device-mobile body #results-section #addMarksBtn i,
html.device-mobile body #results-section #editMarksBtn i {
    font-size: inherit !important;
    margin-right: 12px !important;
}

html.device-mobile body #resultDurationNote.duration-note,
html.device-mobile body .duration-note {
    font-size: 30px !important;
    line-height: 1.3 !important;
    padding: 18px 22px !important;
    margin-top: 18px !important;
    margin-bottom: 10px !important;
    border-radius: 14px !important;
}

html.device-mobile body #resultDurationNote.duration-note .text,
html.device-mobile body .duration-note .text {
    font-size: 30px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
}
