/* Modal navigation only; workspace and attendance layouts stay in mobile-workspace.css. */
.mobile-nav-panel {
    display: none;
}

@media (max-width: 900px) {
    .mobile-nav-panel[open] {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 0 0 0 auto;
        margin: 0;
        width: min(22rem, calc(100vw - 3rem));
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        padding: 0;
        border: 0;
        border-left: 1px solid rgb(255 255 255 / 12%);
        border-radius: 1.1rem 0 0 1.1rem;
        background: var(--navy-950);
        color: var(--white);
        box-shadow: -1rem 0 3rem rgb(7 22 47 / 25%);
        overflow: hidden;
    }

    .mobile-nav-panel::backdrop {
        background: rgb(4 13 30 / 62%);
    }

    .mobile-nav-panel[open] {
        animation: mobile-drawer-enter .18s ease-out;
    }

    @keyframes mobile-drawer-enter {
        from { transform: translateX(100%); }
        to { transform: translateX(0); }
    }

    .mobile-nav-header {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        padding: max(.85rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .85rem 1rem;
        border-bottom: 1px solid rgb(255 255 255 / 12%);
    }

    .mobile-nav-role {
        flex: 1;
        min-width: 0;
    }

    .mobile-nav-role > .role-badge {
        display: block;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        color: var(--white);
        background: transparent;
        font-size: 1rem;
        font-weight: 700;
        letter-spacing: normal;
        text-transform: none;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .mobile-nav-role--switchable > .role-badge {
        display: none;
    }

    .mobile-nav-role .workspace-switcher {
        display: block;
        width: 100%;
        margin: 0;
    }

    .mobile-nav-role .workspace-switcher label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .mobile-nav-role .workspace-switcher > button {
        display: none;
    }

    .mobile-nav-role .workspace-switcher select {
        min-width: 0;
        width: 100%;
        min-height: 44px;
        padding: .5rem 1.6rem .5rem .65rem;
        border: 1px solid rgb(255 255 255 / 20%);
        border-radius: .65rem;
        background-color: #132640;
        color: var(--white);
        color-scheme: dark;
        font-size: 1rem;
        font-weight: 700;
    }

    .mobile-nav-close {
        display: inline-flex;
        flex: 0 0 44px;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: .6rem;
        border: 0;
        border-radius: .65rem;
        background: rgb(255 255 255 / 8%);
        color: var(--white);
        cursor: pointer;
    }

    .mobile-nav-close svg,
    .mobile-nav-panel .nav-icon,
    .mobile-nav-account > summary svg {
        display: block;
        width: 21px;
        height: 21px;
        flex: 0 0 21px;
    }

    .mobile-nav-body {
        display: flex;
        flex: 1;
        flex-direction: column;
        min-width: 0;
        min-height: 0;
        gap: 1rem;
        padding: .75rem max(.75rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) .75rem;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-nav-panel .nav-list {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        flex: 0 0 auto;
        gap: .25rem;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .mobile-nav-panel .nav-item {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: .85rem;
        width: 100%;
        min-width: 0;
        min-height: 48px;
        padding: .75rem .9rem;
        border-radius: .7rem;
        color: #c4cfdf;
        font-size: 1rem;
        font-weight: 550;
        line-height: 1.3;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .mobile-nav-panel .nav-item > span:not(.nav-badge) {
        min-width: 0;
    }

    .mobile-nav-panel .nav-item .nav-badge {
        flex: 0 0 auto;
        margin-left: auto;
    }

    .mobile-nav-panel .nav-item--active,
    .mobile-nav-panel .nav-item[aria-current="page"] {
        color: var(--white);
        background: #163963;
        box-shadow: inset 3px 0 #62b5ff;
        font-weight: 700;
    }

    .mobile-nav-panel .nav-item:hover {
        color: var(--white);
        background: #163963;
    }

    .mobile-nav-panel :is(a, button, select, summary):focus-visible {
        outline: 2px solid #8bd9ff;
        outline-offset: 2px;
    }

    .mobile-nav-account {
        flex: 0 0 auto;
        margin-top: auto;
        padding-top: .5rem;
        border-top: 1px solid rgb(255 255 255 / 12%);
    }

    .mobile-nav-account > summary {
        display: flex;
        align-items: center;
        gap: .85rem;
        min-height: 48px;
        padding: .75rem .9rem;
        border-radius: .7rem;
        color: #c4cfdf;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        list-style: none;
    }

    .mobile-nav-account > summary::-webkit-details-marker {
        display: none;
    }

    .mobile-nav-account > summary svg:last-child {
        width: 18px;
        height: 18px;
        margin-left: auto;
    }

    .mobile-nav-account[open] > summary svg:last-child {
        transform: rotate(180deg);
    }

    .mobile-nav-account .user-menu {
        border: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
        width: 100%;
        margin: .5rem 0;
        padding: 0 .9rem;
        color: #c4cfdf;
    }

    .mobile-nav-account .user-menu > div {
        width: 100%;
        max-width: 100%;
        text-align: left;
        overflow-wrap: anywhere;
    }

    .mobile-nav-account .user-menu__identity strong {
        color: #c4cfdf;
        font-size: .875rem;
        font-weight: 500;
    }

    .mobile-nav-account .user-menu__email {
        color: #c4cfdf;
        font-size: .8rem;
        line-height: 1.4;
    }

    .mobile-nav-account .user-menu .button {
        justify-content: flex-start;
        width: 100%;
        min-height: 44px;
        padding: .6rem 0;
        border: 0;
        background: transparent;
        color: var(--white);
        font-size: .95rem;
        text-align: left;
    }

    .mobile-nav-account .language-switcher {
        width: fit-content;
        max-width: calc(100% - 1.8rem);
        margin: .5rem .9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-nav-panel[open] {
        animation: none;
    }
}
