.mobile-nav-toggle {
    display: none;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #ffffff;
    color: #0f172a;
    border-radius: 12px;
    padding: 0.72rem 0.95rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.mobile-nav-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

.mobile-nav-overlay,
.mobile-nav-drawer,
.mobile-nav-close {
    display: none;
}

@media (max-width: 820px) {
    body.mobile-nav-open {
        overflow: hidden;
    }

    .mobile-nav-toggle {
        display: inline-flex;
    }

    .desktop-auth-nav,
    .desktop-workspace-nav {
        display: none !important;
    }

    .mobile-topbar-actions {
        width: 100%;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .mobile-topbar-actions .portal-user-card {
        order: 3;
        width: 100%;
        text-align: left;
    }

    .mobile-topbar-actions .portal-head-actions {
        order: 4;
        width: 100%;
    }

    .mobile-topbar-actions .portal-head-actions .btn {
        flex: 1 1 auto;
    }

    .mobile-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
        z-index: 69;
    }

    .mobile-nav-overlay.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-nav-drawer {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(92vw, 390px);
        max-width: 100%;
        background: #ffffff;
        z-index: 70;
        box-shadow: -18px 0 40px rgba(15, 23, 42, 0.18);
        transform: translateX(100%);
        transition: transform 0.24s ease;
        flex-direction: column;
        overflow: hidden;
        max-height: 100dvh;
    }

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

    .mobile-nav-drawer-head,
    .mobile-nav-drawer-foot {
        padding: 16px;
        background: #ffffff;
    }

    .mobile-nav-drawer-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    }

    .mobile-nav-drawer-head strong {
        display: block;
        margin-top: 6px;
        font-size: 1rem;
    }

    .mobile-nav-drawer-foot {
        margin-top: auto;
        border-top: 1px solid rgba(15, 23, 42, 0.08);
        display: grid;
        gap: 10px;
    }

    .mobile-nav-drawer-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
        display: grid;
        gap: 18px;
    }

    .mobile-nav-close {
        display: inline-grid;
        place-items: center;
        width: 42px;
        height: 42px;
        border-radius: 999px;
        border: 1px solid rgba(15, 23, 42, 0.1);
        background: #ffffff;
        color: #0f172a;
        font-size: 1.6rem;
        line-height: 1;
        cursor: pointer;
        flex: 0 0 auto;
    }

    .mobile-nav-section {
        display: grid;
        gap: 10px;
        padding: 14px;
        border-radius: 18px;
        border: 1px solid rgba(15, 23, 42, 0.08);
        background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    }

    .mobile-nav-section-title {
        font-size: 0.84rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--muted);
        font-weight: 800;
        padding: 0 2px;
    }

    .mobile-nav-link-list {
        display: grid;
        gap: 8px;
    }

    .mobile-nav-link-list a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 48px;
        padding: 0 14px;
        border-radius: 16px;
        background: #ffffff;
        border: 1px solid rgba(15, 23, 42, 0.07);
        color: var(--text);
        font-weight: 700;
        text-decoration: none;
    }

    .mobile-nav-link-list a.is-active {
        background: rgba(15, 118, 110, 0.12);
        border-color: rgba(15, 118, 110, 0.18);
        color: var(--primary);
    }

    .mobile-nav-drawer-foot .btn {
        width: 100%;
    }
}


@media (max-width: 820px) {
    .topbar {
        backdrop-filter: none;
    }

    .topbar-main {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .topbar-brand-row {
        flex: 1 1 auto;
        min-width: 0;
        align-items: center;
    }

    .topbar-home-link {
        min-height: 38px;
        padding: 0 12px;
        font-size: 0.9rem;
    }

    .mobile-topbar-actions {
        width: auto;
        margin-left: auto;
        flex-wrap: nowrap;
    }

    .mobile-topbar-actions .portal-user-card,
    .mobile-topbar-actions .portal-head-actions,
    .mobile-topbar-actions .topbar-user-pill {
        display: none !important;
    }

    .mobile-nav-overlay {
        inset: 0;
        z-index: 9998;
    }

    .mobile-nav-drawer {
        left: auto;
        right: 0;
        width: min(92vw, 390px);
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        z-index: 9999;
    }

    .mobile-nav-drawer-head,
    .mobile-nav-drawer-foot {
        position: relative;
        z-index: 1;
    }

    .mobile-nav-drawer-body {
        padding-bottom: 28px;
    }
}
