:root {
    --brand-navy: #0f2747;
    --brand-teal: #0a8f8d;
    --brand-sand: #f5f2ea;
    --brand-ink: #1f2937;
    --panel: #ffffff;
}

html, body {
    height: 100%;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #eef4ff 0%, #f8fbef 100%);
    color: var(--brand-ink);
}

body.loader-active {
    overflow: hidden;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.sidebar {
    background: linear-gradient(180deg, var(--brand-navy), #183e6e);
    color: white;
    padding: 2rem 1.25rem;
}

.brand {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.sidebar .nav-link {
    color: rgba(255,255,255,.85);
    border-radius: 12px;
    margin-bottom: .35rem;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,.12);
    color: white;
}

.mobile-nav-drawer,
.mobile-nav-backdrop,
.mobile-menu-toggle {
    display: none;
}

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 85vw);
    height: 100vh;
    padding: 1.25rem 1rem 1.5rem;
    background: linear-gradient(180deg, var(--brand-navy), #183e6e);
    color: white;
    box-shadow: 0 24px 60px rgba(15, 39, 71, .35);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 2100;
    overflow-y: auto;
}

.mobile-nav-drawer.is-open {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.mobile-nav-links .nav-link {
    color: rgba(255,255,255,.9);
    border-radius: 12px;
    margin-bottom: .35rem;
    padding: .75rem .9rem;
}

.mobile-nav-links .nav-link:hover,
.mobile-nav-links .nav-link:focus {
    background: rgba(255,255,255,.12);
    color: white;
}

.mobile-nav-divider {
    border-color: rgba(255,255,255,.2);
    margin: .75rem 0 1rem;
}

.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 39, 71, .42);
    z-index: 2050;
}

.mobile-menu-toggle {
    margin-bottom: .75rem;
}

.content {
    padding: 1.5rem;
}

.topbar {
    background: linear-gradient(90deg, var(--brand-teal), #0f7a79);
    color: white;
    padding: 1.25rem 1.5rem;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 18px 50px rgba(15, 39, 71, .18);
}

.page-body {
    margin-top: 1.5rem;
}

.stat-card {
    background: var(--panel);
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.stat-card strong {
    font-size: 2rem;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-panel {
    width: min(960px, 92vw);
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 2rem;
    align-items: center;
}

.login-panel h1 {
    font-size: 4rem;
    color: var(--brand-navy);
}

.dataTables_wrapper .row {
    margin-bottom: .75rem;
}

.global-loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 39, 71, .35);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
    z-index: 2000;
}

.global-loader.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.global-loader__panel {
    min-width: 220px;
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 20px 50px rgba(15, 39, 71, .22);
    text-align: center;
}

.global-loader__spinner {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--brand-teal);
}

.global-loader__text {
    margin-top: .75rem;
    font-weight: 600;
    color: var(--brand-navy);
}

.app-modal-dialog {
    max-width: min(1140px, calc(100vw - 2rem));
}

#appModalContent {
    overflow-x: hidden;
}

.employee-form {
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 900px);
}

.employee-form .modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(88vh - 9rem);
}

.employee-form .filterable-search,
.employee-form .form-select,
.employee-form .form-control {
    max-width: 100%;
}

.employee-form .role-select,
.employee-form .manager-select {
    min-height: 11rem;
}

.job-form {
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 900px);
}

.job-form .modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(88vh - 9rem);
}

@media (max-width: 991.98px) {
    .app-modal-dialog {
        max-width: 100%;
    }

    .employee-form {
        max-height: 100%;
    }

    .employee-form .modal-body {
        max-height: calc(100vh - 8.5rem);
    }

    .employee-form .role-select,
    .employee-form .manager-select {
        min-height: 9rem;
    }

    .job-form {
        max-height: 100%;
    }

    .job-form .modal-body {
        max-height: calc(100vh - 8.5rem);
    }
}

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

    .sidebar {
        display: none;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-nav-drawer {
        display: block;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: .75rem;
    }

    .login-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .content {
        padding: 1rem;
    }

    .topbar {
        padding: 1rem;
        border-radius: 16px;
    }

    .topbar h1 {
        font-size: 1.5rem;
    }

    .employee-form .modal-body {
        max-height: calc(100vh - 8rem);
    }

    .employee-form .modal-body {
        padding: 1rem;
    }

    .job-form .modal-body {
        max-height: calc(100vh - 8rem);
        padding: 1rem;
    }

    .employee-form .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .job-form .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }
}
