* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: #f0f4f8; color: #333; overflow-x: hidden; }

/* ================= SCREENS LOGIC ================= */
.screen { display: none; width: 100%; min-height: 100vh; animation: fadeIn 0.3s ease-in-out; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ================= AUTH SCREENS ================= */
.screen.auth-screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.card { background: #ffffff; border-radius: 16px; padding: 30px 25px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); width: 100%; max-width: 400px; }
h1 { font-size: 22px; font-weight: 700; color: #1a202c; text-align: center; margin-bottom: 5px; }
h2 { font-size: 20px; font-weight: 600; color: #1a202c; margin-bottom: 5px; }
.subtitle { font-size: 14px; color: #718096; margin-bottom: 25px; text-align: left; }
#welcome-screen .subtitle { text-align: center; margin-bottom: 30px; }

/* Inputs & Buttons */
.input-group { margin-bottom: 18px; text-align: left; }
.input-group label { display: block; font-size: 13px; font-weight: 500; color: #4a5568; margin-bottom: 6px; }
.input-group input { width: 100%; padding: 12px 15px; font-size: 14px; border: 1px solid #e2e8f0; border-radius: 8px; background-color: #f8fafc; transition: all 0.2s; }
.input-group input:focus { outline: none; border-color: #3182ce; background-color: #fff; box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1); }

.btn { padding: 14px 20px; font-size: 15px; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; text-align: center; transition: 0.2s;}
.btn:active { transform: scale(0.98); }
.btn-primary { background-color: #3182ce; color: #fff; }
.btn-success { background-color: #38a169; color: #fff; }
.btn-outline { background-color: transparent; color: #3182ce; border: 2px solid #3182ce; }
.full-width { width: 100%; }
.btn-group { display: flex; flex-direction: column; gap: 15px; }
.bottom-text { margin-top: 20px; font-size: 14px; text-align: center; color: #718096; }
.link { color: #3182ce; font-weight: 600; cursor: pointer; }
.logo-placeholder { width: 60px; height: 60px; background: linear-gradient(135deg, #1e3a8a, #3182ce); color: white; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 24px; font-weight: bold; margin: 0 auto 20px auto; }

/* ================= DASHBOARD LAYOUT & TOP BAR ================= */
.app-layout { background-color: #f4f7f6; height: auto; min-height: 100vh; padding-bottom: 80px; box-sizing: border-box; }
.top-bar { position: fixed; top: 0; left: 0; right: 0; height: 60px; background-color: #ffffff; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); z-index: 100; transition: all 0.3s ease; }
.menu-btn { font-size: 24px; cursor: pointer; color: #3182ce; }
.page-title { font-size: 18px; font-weight: 600; color: #1a202c; }
.content-area { padding: 80px 20px 20px 20px; max-width: 100%; margin: 0 auto; box-sizing: border-box; transition: all 0.3s ease; }

/* Dashboard Basic Content */
.section-title { font-size: 16px; font-weight: 600; margin: 25px 0 10px 0; color: #2d3748; }

/* ================= MODERN SIDEBAR (PREMIUM UI) ================= */
.side-menu {
    position: fixed; top: 0; left: -280px; width: 280px; height: 100vh;
    background-color: #ffffff; box-shadow: 4px 0 15px rgba(0,0,0,0.05);
    z-index: 1000; transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column;
}
.side-menu.open { left: 0; }

.sidebar-header {
    display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 64px;
    background: linear-gradient(135deg, #1e3a8a, #3182ce); color: white; box-sizing: border-box; flex-shrink: 0;
}
.company-logo {
    width: 42px; height: 42px; background: transparent; border-radius: 10px;
    display: flex; justify-content: center; align-items: center; flex-shrink: 0;
}
.company-logo img {
    width: 40px; height: 40px; border-radius: 10px; object-fit: contain;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18); display: block;
}
.company-info h2 { font-size: 16px; margin: 0; color: #fff; font-weight: 600; letter-spacing: 0.5px; }
.company-info p { font-size: 11px; margin: 0; color: #bfdbfe; text-transform: uppercase; letter-spacing: 1px;}
.close-sidebar { margin-left: auto; font-size: 28px; cursor: pointer; color: #bfdbfe; transition: 0.2s; line-height: 1;}
.close-sidebar:hover { color: white; transform: scale(1.1); }

.sidebar-user-profile { display: flex; align-items: center; gap: 12px; padding: 20px; border-bottom: 1px solid #edf2f7; }
.user-avatar {
    width: 45px; height: 45px; background: #ebf8ff; color: #3182ce; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; font-weight: 700; font-size: 16px; border: 2px solid #bee3f8;
}

.sidebar-menu-items { padding: 15px 0; flex: 1; overflow-y: auto; }
.menu-label { font-size: 10px; font-weight: 700; color: #a0aec0; margin: 10px 20px 5px 20px; letter-spacing: 1px; }
.menu-item {
    display: flex; align-items: center; gap: 15px; padding: 12px 20px; text-decoration: none;
    color: #4a5568; font-size: 14px; font-weight: 500; transition: 0.2s; border-left: 3px solid transparent;
}
.menu-item:hover { background: #f8fafc; color: #3182ce; border-left-color: #3182ce; }
.menu-item.active { background: #ebf8ff; color: #3182ce; font-weight: 700; border-left-color: #3182ce; }

/* Sidebar Dropdown & Submenu */
.menu-dropdown-container {
    display: flex;
    flex-direction: column;
}
.menu-dropdown-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    cursor: pointer !important;
    user-select: none !important;
}
.menu-dropdown-toggle .dropdown-caret {
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.2s ease;
}
.menu-submenu {
    background: #f8fafc;
    border-left: 2px solid #e2e8f0;
    margin-left: 20px;
    margin-top: 2px;
    margin-bottom: 6px;
    border-radius: 0 8px 8px 0;
    overflow: hidden;
}
.menu-submenu .submenu-item {
    padding: 9px 16px 9px 14px !important;
    font-size: 13px !important;
    color: #475569 !important;
    border-left: 2px solid transparent !important;
    gap: 10px !important;
    text-decoration: none !important;
}
.menu-submenu .submenu-item:hover {
    color: #3182ce !important;
    background: #edf2f7 !important;
    border-left-color: #3182ce !important;
}
.menu-submenu .submenu-item.active {
    color: #2b6cb0 !important;
    background: #ebf8ff !important;
    font-weight: 700 !important;
    border-left-color: #3182ce !important;
}
.menu-item.active { background: #ebf8ff; color: #2b6cb0; border-left-color: #3182ce; font-weight: 600; }
.menu-item .icon { font-size: 18px; }

.sidebar-footer { padding: 15px 20px; border-top: 1px solid #edf2f7; background: #f8fafc; }
.logout-btn {
    display: flex; align-items: center; gap: 10px; text-decoration: none; color: #e53e3e;
    font-weight: 600; font-size: 14px; padding: 10px; border-radius: 8px; transition: 0.2s;
}
.logout-btn:hover { background: #fed7d7; }

.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; display: none; }
.overlay.active { display: block; }

/* ==========================================================================
   🖥️ FULL DESKTOP & MOBILE RESPONSIVE ARCHITECTURE (SERVESAAS / MES STANDARD)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. MOBILE & SMALL TABLET VIEW (< 900px)
   -------------------------------------------------------------------------- */
@media (max-width: 899px) {
    /* Off-canvas Left Drawer */
    .side-menu {
        position: fixed !important;
        top: 0 !important;
        left: -280px !important;
        width: 280px !important;
        height: 100vh !important;
        z-index: 1200 !important;
        background: #ffffff !important;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15) !important;
        transition: left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .side-menu.open {
        left: 0 !important;
    }

    .close-sidebar {
        display: block !important;
    }

    .menu-btn {
        display: block !important;
        font-size: 24px !important;
        cursor: pointer !important;
        color: #3182ce !important;
    }

    /* Top bar back button styling for mobile */
    .topbar-back-btn,
    .back-btn,
    .top-bar .menu-btn:not([onclick*="toggleMenu"]) {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        font-size: 20px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        background: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        margin-right: 8px !important;
        transition: all 0.2s ease !important;
        user-select: none !important;
        flex-shrink: 0 !important;
        line-height: 1 !important;
    }

    .topbar-back-btn:hover,
    .back-btn:hover,
    .top-bar .menu-btn:not([onclick*="toggleMenu"]):hover {
        background: #3182ce !important;
        color: #ffffff !important;
        border-color: #3182ce !important;
    }

    /* Viewport Container */
    #page-content,
    .app-viewport,
    .app-main-viewport {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100vh !important;
        box-sizing: border-box !important;
        background-color: #f4f7f6 !important;
    }

    /* Top Bar across mobile width */
    .top-bar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 60px !important;
        padding: 0 16px !important;
        background-color: #ffffff !important;
        border-bottom: 1px solid #e2e8f0 !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
        z-index: 800 !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    /* Content Area with room below topbar and above bottom nav */
    #page-content .content-area,
    #page-content main.content-area,
    #page-content main.dash-wrapper,
    #page-content .dash-wrapper,
    .content-area {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 75px 16px 85px 16px !important;
        box-sizing: border-box !important;
    }

    /* Subpage / dedicated page content padding to clear the 60px mobile fixed topbar */
    #leave-screen > div,
    #contractors-screen > div,
    #contractors-form-screen > div:not(.top-bar),
    #contractors-details-screen > div:not(.top-bar),
    #employment-types-screen > div,
    #salary-config-screen > div,
    #hr-reports > div,
    #punch-location > div:not(.top-bar),
    #hr-holidays > div:not(.top-bar),
    #hr-announcements > div:not(.top-bar),
    #hr-advance-salary > div:not(.top-bar),
    #company-setup > div:not(.top-bar),
    #hr-departments > div:not(.top-bar),
    #hr-dept-details > div:not(.top-bar),
    #hr-locations > div:not(.top-bar),
    #hr-loc-details > div:not(.top-bar),
    #hr-managers > div:not(.top-bar),
    #hr-hierarchy > div:not(.top-bar),
    #hr-shifts > div:not(.top-bar),
    #hr-shift-details > div:not(.top-bar),
    #hr-shift-form > div:not(.top-bar),
    #hr-shift-assign > div:not(.top-bar),
    #hr-pattern-list > div:not(.top-bar),
    #hr-pattern-details > div:not(.top-bar),
    #hr-pattern-form > div:not(.top-bar),
    #hr-pattern-assign > div:not(.top-bar),
    .subpage-content-wrapper {
        padding-top: 76px !important;
        box-sizing: border-box !important;
    }

    /* Mobile Bottom Navigation */
    #hr-bottom-nav,
    .bottom-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 65px !important;
        background-color: #ffffff !important;
        border-top: 1px solid #e2e8f0 !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
        z-index: 900 !important;
    }
}

/* --------------------------------------------------------------------------
   2. FULL DESKTOP VIEW (>= 900px)
   -------------------------------------------------------------------------- */
@media (min-width: 900px) {
    /* Hide Mobile Bottom Nav completely on desktop */
    #hr-bottom-nav,
    .bottom-nav {
        display: none !important;
    }

    /* Permanent Fixed Left Sidebar (260px) - ONLY when in-app-mode and NOT loading/auth/kiosk/portal */
    body.in-app-mode:not(.app-loading):not(.auth-mode):not(.kiosk-mode):not(.portal-mode):not(.contractor-mode) .side-menu {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 260px !important;
        height: 100vh !important;
        z-index: 1000 !important;
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        border-right: 1px solid #e2e8f0 !important;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04) !important;
        box-sizing: border-box !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Hide close button & drawer overlay on desktop */
    .close-sidebar {
        display: none !important;
    }
    .overlay, #menu-overlay {
        display: none !important;
    }

    /* Top Bar starts cleanly after the 260px sidebar */
    body.in-app-mode:not(.app-loading):not(.auth-mode):not(.kiosk-mode):not(.portal-mode):not(.contractor-mode) .top-bar {
        position: fixed !important;
        top: 0 !important;
        left: 260px !important;
        width: calc(100% - 260px) !important;
        right: 0 !important;
        height: 64px !important;
        padding: 0 32px !important;
        background-color: #ffffff !important;
        border-bottom: 1px solid #e2e8f0 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
        z-index: 800 !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Hide hamburger menu button on desktop, BUT display back buttons */
    .menu-btn:not(.back-btn):not(.topbar-back-btn) {
        display: none !important;
    }

    /* Back buttons in top bar (ALWAYS visible on desktop) */
    .topbar-back-btn,
    .back-btn,
    .top-bar .menu-btn:not([onclick*="toggleMenu"]) {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 38px !important;
        height: 38px !important;
        border-radius: 10px !important;
        cursor: pointer !important;
        font-size: 20px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        background: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        margin-right: 12px !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        user-select: none !important;
        flex-shrink: 0 !important;
        line-height: 1 !important;
    }

    .topbar-back-btn:hover,
    .back-btn:hover,
    .top-bar .menu-btn:not([onclick*="toggleMenu"]):hover {
        background: #3182ce !important;
        color: #ffffff !important;
        border-color: #3182ce !important;
        transform: translateX(-3px) !important;
        box-shadow: 0 4px 12px rgba(49, 130, 206, 0.25) !important;
    }

    .topbar-back-btn:active,
    .back-btn:active,
    .top-bar .menu-btn:not([onclick*="toggleMenu"]):active {
        transform: scale(0.95) !important;
    }

    .page-title {
        font-size: 20px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
    }

    /* Router Viewport starts cleanly after the 260px sidebar ONLY in-app-mode */
    body.in-app-mode:not(.app-loading):not(.auth-mode):not(.kiosk-mode):not(.portal-mode):not(.contractor-mode) #page-content,
    body.in-app-mode:not(.app-loading):not(.auth-mode):not(.kiosk-mode):not(.portal-mode):not(.contractor-mode) .app-viewport,
    body.in-app-mode:not(.app-loading):not(.auth-mode):not(.kiosk-mode):not(.portal-mode):not(.contractor-mode) .app-main-viewport {
        margin-left: 260px !important;
        margin-right: 0 !important;
        width: calc(100% - 260px) !important;
        max-width: calc(100% - 260px) !important;
        min-height: 100vh !important;
        box-sizing: border-box !important;
        position: relative !important;
        background-color: #f4f7f6 !important;
    }

    /* Screen content inside the viewport:
       Zero extra margin, 100% width of viewport, padded below the 64px top bar */
    #page-content .content-area,
    #page-content main.content-area,
    #page-content main.dash-wrapper,
    #page-content .dash-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 84px 32px 40px 32px !important;
        box-sizing: border-box !important;
        min-height: 100vh !important;
    }

    /* Dedicated Screen Containers */
    #leave-screen,
    #contractors-screen,
    #contractors-form-screen,
    #contractors-details-screen,
    #employment-types-screen,
    #salary-config-screen,
    #hr-reports,
    #hr-dashboard,
    #hr-employees,
    #hr-attendance,
    #hr-payroll,
    #hr-admin-profile,
    #hr-settings {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #leave-screen > div,
    #contractors-screen > div,
    #contractors-form-screen > div:not(.top-bar),
    #contractors-details-screen > div:not(.top-bar),
    #employment-types-screen > div,
    #salary-config-screen > div,
    #hr-reports > div,
    #punch-location > div:not(.top-bar),
    #hr-holidays > div:not(.top-bar),
    #hr-announcements > div:not(.top-bar),
    #hr-advance-salary > div:not(.top-bar),
    #company-setup > div:not(.top-bar),
    #hr-departments > div:not(.top-bar),
    #hr-dept-details > div:not(.top-bar),
    #hr-locations > div:not(.top-bar),
    #hr-loc-details > div:not(.top-bar),
    #hr-managers > div:not(.top-bar),
    #hr-hierarchy > div:not(.top-bar),
    #hr-shifts > div:not(.top-bar),
    #hr-shift-details > div:not(.top-bar),
    #hr-shift-form > div:not(.top-bar),
    #hr-shift-assign > div:not(.top-bar),
    #hr-pattern-list > div:not(.top-bar),
    #hr-pattern-details > div:not(.top-bar),
    #hr-pattern-form > div:not(.top-bar),
    #hr-pattern-assign > div:not(.top-bar),
    .subpage-content-wrapper {
        padding-top: 84px !important;
        box-sizing: border-box !important;
    }

    /* Remove excessive mobile bottom-padding on screens */
    .app-layout {
        padding-bottom: 30px !important;
        min-height: 100vh !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    /* Inner containers inside .content-area */
    .dash-wrapper > div,
    .content-area > div,
    .prof-page-container {
        max-width: 1440px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .dash-card {
        max-width: 100% !important;
    }
}

/* --------------------------------------------------------------------------
   3. AUTHENTICATION & LOGGED-OUT MODE
   -------------------------------------------------------------------------- */
body.app-loading .side-menu,
body.app-loading #side-menu,
body.app-loading #hr-bottom-nav,
body.app-loading .bottom-nav,
body.app-loading .top-bar,
body.auth-mode .side-menu,
body.auth-mode #hr-bottom-nav,
body.auth-mode .bottom-nav,
body.auth-mode .top-bar,
body.kiosk-mode .side-menu,
body.kiosk-mode #hr-bottom-nav,
body.kiosk-mode .bottom-nav,
body.kiosk-mode > .top-bar,
body.portal-mode .side-menu,
body.portal-mode #hr-bottom-nav,
body.portal-mode .bottom-nav,
body.contractor-mode .side-menu,
body.contractor-mode #hr-bottom-nav,
body.contractor-mode .bottom-nav {
    display: none !important;
}

body.kiosk-mode #page-content,
body.kiosk-mode .app-main-viewport,
body.portal-mode #page-content,
body.portal-mode .app-main-viewport,
body.contractor-mode #page-content,
body.contractor-mode .app-main-viewport {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}

body.auth-mode #page-content,
body.auth-mode .app-viewport,
body.auth-mode .app-main-viewport {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #f0f4f8 !important;
    padding: 0 !important;
}

body.auth-mode .auth-pages-wrapper {
    width: 100% !important;
    min-height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

body.auth-mode .screen.auth-screen.active {
    width: 100% !important;
    min-height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

body.auth-mode .card {
    width: 100% !important;
    max-width: 420px !important;
    margin: 0 auto !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04) !important;
}

/* ================= MODERN PROFILE ICON (TOP BAR) ================= */
.profile-widget { position: relative; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.profile-avatar {
    width: 36px; height: 36px; background: linear-gradient(135deg, #3182ce, #2b6cb0); color: white;
    border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 14px;
    font-weight: bold; box-shadow: 0 2px 5px rgba(49, 130, 206, 0.3); transition: 0.2s;
}
.profile-widget:active .profile-avatar { transform: scale(0.9); }
/* Online Green Dot */
.profile-status {
    position: absolute; bottom: 0; right: 0; width: 10px; height: 10px;
    background: #38a169; border: 2px solid #fff; border-radius: 50%;
}

/* ================= BOTTOM NAV ================= */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 65px; background-color: #ffffff; display: flex; justify-content: space-around; align-items: center; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 100; }
.nav-item { display: flex; flex-direction: column; align-items: center; color: #a0aec0; cursor: pointer; width: 25%; }
.nav-icon { font-size: 20px; margin-bottom: 4px; }
.nav-item span { font-size: 11px; font-weight: 500; }
.nav-item.active { color: #3182ce; }


/* ================= NEW FORM INPUT (For Search and Filters) ================= */
.form-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 14px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    background-color: #fff;
    transition: all 0.2s;
    outline: none;
    color: #2d3748;
}
.form-input:focus {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}


/* ================= REPORTS SCREEN STYLES ================= */

.report-card {
    background: #fff; padding: 20px; border-radius: 12px; text-align: center;
    border: 1px solid #e2e8f0; font-weight: bold; cursor: pointer; color: #2d3748;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); transition: 0.3s;
}
.report-card:hover { border-color: #3182ce; color: #3182ce; }

.report-list-card {
    background: #fff; padding: 15px; border-radius: 12px; 
    display: flex; align-items: center; border: 1px solid #edf2f7; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.02); cursor: pointer; transition: 0.2s;
}
.report-list-card:hover { border-color: #3182ce; transform: translateY(-2px); }

.report-icon {
    width: 45px; height: 45px; border-radius: 10px; display: flex; 
    align-items: center; justify-content: center; font-size: 22px; margin-right: 15px;
}
.bg-blue { background: #ebf8ff; }
.bg-green { background: #f0fff4; }
.bg-yellow { background: #fffff0; }
.bg-cyan { background: #e6fffa; }
.bg-red { background: #fff5f5; }

.report-text { flex: 1; }
.rt-title { font-weight: bold; color: #2d3748; font-size: 15px; margin-bottom: 3px; }
.rt-sub { font-size: 11px; color: #718096; }
.report-arrow { color: #cbd5e0; font-size: 14px; font-weight: bold; }

.filter-chip {
    padding: 6px 14px; border-radius: 20px; background: #edf2f7; font-size: 12px;
    cursor: pointer; border: 1px solid transparent; transition: 0.2s;
    color: #4a5568; font-weight: 600; display: inline-block; white-space: nowrap;
}
.filter-chip.active { background: #3182ce; color: #fff; border-color: #2b6cb0; box-shadow: 0 2px 4px rgba(49, 130, 206, 0.3); }

.report-item-row {
    display: flex; align-items: center; padding: 12px 15px; border-bottom: 1px solid #f7fafc;
    font-size: 13px; gap: 12px; cursor: pointer; transition: background 0.1s;
}
.report-item-row:hover { background: #f8fafc; }
.report-item-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: #3182ce; }

.format-card {
    flex: 1; padding: 20px; border: 2px solid #edf2f7; border-radius: 12px;
    text-align: center; cursor: pointer; transition: 0.2s; font-weight: bold;
}
.format-card:hover { transform: scale(1.02); border-color: #38a169; color: #38a169; }


/* ============================================================================ */
/* RESPONSIVE OPTIMIZATIONS: DEPARTMENTS, DESIGNATIONS & LOCATIONS             */
/* ============================================================================ */

.btn-top-back {
    transition: background-color 0.15s, transform 0.15s;
}
.btn-top-back:hover {
    background-color: #edf2f7 !important;
}
.btn-top-back:active {
    transform: scale(0.95);
}

.dept-card, .loc-card {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}
.dept-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(49, 130, 206, 0.12) !important;
    border-color: #bee3f8 !important;
}
.loc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(56, 161, 105, 0.12) !important;
    border-color: #c6f6d5 !important;
}

/* Desktop Grid & Viewport Adjustments */
@media (min-width: 769px) {
    #department-list-container, #location-list-container {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
        gap: 16px !important;
    }
    #dept-roles-container, #loc-depts-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
        gap: 14px !important;
    }
}

/* Mobile Screens Adjustments */
@media (max-width: 768px) {
    #department-list-container, #location-list-container {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    #dept-roles-container, #loc-depts-container {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .dept-card, .loc-card {
        padding: 14px 16px !important;
    }
    .top-bar {
        padding: 0 12px !important;
    }
    .top-bar .page-title {
        font-size: 16px !important;
    }
}

/* ================= GLOBAL MODAL & OVERLAY PROTECTION ================= */
.custom-modal,
.payroll-modal-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.6) !important;
    z-index: 99999 !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 15px !important;
    backdrop-filter: blur(3px) !important;
    box-sizing: border-box !important;
}

.custom-modal.show,
.custom-modal.active,
.payroll-modal-overlay.show,
.payroll-modal-overlay.active {
    display: flex !important;
}

.payroll-modal-box {
    background: #fff;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.payroll-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.payroll-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.payroll-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
}

/* ================= RESPONSIVE VIEWPORT UTILITIES ================= */
.desktop-only {
    display: block !important;
}
.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: flex !important;
    }
}

/* ==========================================================================
   APP INITIAL LOADING & SPLASH SCREEN STYLES
   ========================================================================== */
body.app-loading {
    overflow: hidden !important;
}

body.app-loading .side-menu,
body.app-loading #side-menu,
body.app-loading #hr-bottom-nav,
body.app-loading .bottom-nav,
body.app-loading .top-bar {
    display: none !important;
    visibility: hidden !important;
}

body.app-loading .content-area,
body.app-loading .app-main-viewport,
body.app-loading #page-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}

/* Splash Screen Container */
.app-splash-screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px;
    box-sizing: border-box;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.app-splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 380px;
    width: 100%;
}

.splash-logo-container {
    margin-bottom: 24px;
    position: relative;
}

.splash-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 26px;
    box-shadow: 0 12px 32px rgba(49, 130, 206, 0.25);
    display: block;
    animation: splashPulse 2.2s ease-in-out infinite;
}

@keyframes splashPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.splash-spinner-container {
    margin-bottom: 16px;
}

.splash-spinner {
    width: 38px;
    height: 38px;
    border: 3.5px solid #e2e8f0;
    border-top-color: #3182ce;
    border-radius: 50%;
    animation: splashSpin 0.8s linear infinite;
}

@keyframes splashSpin {
    to {
        transform: rotate(360deg);
    }
}

.splash-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.splash-title {
    font-size: 19px;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
    letter-spacing: 0.3px;
}

.splash-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: #718096;
    margin: 0;
}

/* Splash Offline Box */
.splash-offline-box {
    margin-top: 20px;
    padding: 18px 22px;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease;
}

.splash-offline-box .offline-icon {
    font-size: 34px;
}

.splash-offline-box .offline-title {
    font-size: 16px;
    font-weight: 700;
    color: #c53030;
    margin: 0;
}

.splash-offline-box .offline-desc {
    font-size: 13px;
    color: #742a2a;
    line-height: 1.4;
    margin: 0;
}

.splash-retry-btn {
    margin-top: 8px;
    padding: 10px 22px;
    font-size: 13.5px;
    font-weight: 600;
    background: #3182ce;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(49, 130, 206, 0.35);
    transition: background 0.2s, transform 0.1s;
}

.splash-retry-btn:hover {
    background: #2b6cb0;
    transform: translateY(-1px);
}

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

/* Global Network Status Banner */
.global-network-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease, opacity 0.3s ease;
    transform: translateY(0);
}

.global-network-banner.offline {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.global-network-banner.online {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.global-network-banner.slide-up {
    transform: translateY(-100%);
}

.network-banner-btn {
    padding: 4px 12px;
    font-size: 11.5px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.network-banner-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}


