:root {
    --sidebar-width: 250px;
    --navbar-height: 56px;
}

body {
    min-height: 100vh;
    background: #f4f6f9;
}

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

.login-card {
    width: min(100%, 420px);
}

.access-denied-code {
    color: #dc3545;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: calc(100vh - 56px);
}

.app-content {
    padding: 2rem;
}

.admin-sidebar {
    padding: 1.5rem 1rem;
    color: #c2c7d0;
    background: #343a40;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.12);
}

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

.hamburger-icon {
    display: grid;
    width: 1.25rem;
    gap: 0.25rem;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.sidebar-title {
    padding: 0.5rem 0.75rem;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-group {
    margin-bottom: 0.75rem;
}

.sidebar-group > summary {
    cursor: pointer;
    list-style: none;
    border-radius: 0.375rem;
}

.sidebar-group > summary::-webkit-details-marker {
    display: none;
}

.sidebar-group > summary::after {
    float: right;
    content: "+";
    font-size: 1rem;
}

.sidebar-group[open] > summary::after {
    content: "-";
}

.sidebar-group > summary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-group-content {
    padding-top: 0.25rem;
}

.sidebar-group-content .sidebar-link {
    padding-left: 1.25rem;
}

.sidebar-link {
    display: block;
    padding: 0.75rem;
    border-radius: 0.375rem;
    color: #c2c7d0;
    text-decoration: none;
}

.sidebar-button {
    width: 100%;
    border: 0;
    text-align: left;
    background: transparent;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: #fff;
    background: #0d6efd;
}

.reference-options {
    display: grid;
    max-height: 12rem;
    gap: 0.25rem;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
}

.reference-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.reference-option:hover {
    background: #f1f3f5;
}

.dashboard-card {
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-card:hover {
    color: inherit;
    transform: translateY(-2px);
}

.table-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0;
    border: 0;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-align: left;
    background: transparent;
}

.table-sort-button:hover,
.table-sort-button:focus-visible {
    color: #0d6efd;
}

.table-sort-indicator {
    color: #6c757d;
    font-size: 0.85em;
}

@media (max-width: 767.98px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .app-navbar {
        position: relative;
        z-index: 1050;
        min-height: var(--navbar-height);
    }

    .app-navbar .container-fluid {
        flex-wrap: nowrap;
    }

    .app-username {
        display: none;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
    }

    .app-shell {
        display: block;
    }

    .admin-sidebar {
        position: fixed;
        z-index: 1040;
        top: var(--navbar-height);
        bottom: 0;
        left: 0;
        width: min(var(--sidebar-width), 85vw);
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }

    .admin-sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 1030;
        inset: var(--navbar-height) 0 0;
        width: 100%;
        padding: 0;
        border: 0;
        background: rgba(0, 0, 0, 0.45);
    }

    .sidebar-backdrop.is-open {
        display: block;
    }

    .app-content {
        width: 100%;
        min-width: 0;
        padding: 1.25rem;
        overflow-x: hidden;
    }
}
